"CASE" function in Excel
Solved
pleduc
Posted messages
8
Registration date
Status
Membre
-
anonyme -
anonyme -
Hello,
I would like to use a function like "CASE" in Excel instead of nesting "IF" functions within each other. My goal is to perform the following test:
If Cell A1 = Cell B1 then ...
If Cell A1 = Cell B2 then ...
If Cell A1 = Cell B3 then ...
If Cell A1 = Cell B4 then ...
If Cell A1 = Cell B5 then ...
If Cell A1 = Cell B6 then ...
...
Thank you in advance
I would like to use a function like "CASE" in Excel instead of nesting "IF" functions within each other. My goal is to perform the following test:
If Cell A1 = Cell B1 then ...
If Cell A1 = Cell B2 then ...
If Cell A1 = Cell B3 then ...
If Cell A1 = Cell B4 then ...
If Cell A1 = Cell B5 then ...
If Cell A1 = Cell B6 then ...
...
Thank you in advance
2 answers
Hello to both of you,
Pleduc, as far as I know, the CASE you’re talking about, which advantageously replaces IF functions, is a VBA Excel instruction and is not used directly in Excel formulas.
In which case, the syntax is as follows:
Pleduc, as far as I know, the CASE you’re talking about, which advantageously replaces IF functions, is a VBA Excel instruction and is not used directly in Excel formulas.
In which case, the syntax is as follows:
Select Case Range("A1").Value Case Is = Range("B1").Value 'instructions Case Is = Range("B2").Value 'instructions Case Else 'instructions in case none of the conditions are met End Select
Thank you very much, it works!
It works very well.
=CHOOSE(index; Val1, Val2....)
index: is the cell to evaluate
Val1: is the value returned if the index cell is equal to 1
Val2: is the value returned if the index cell is equal to 2 ...