jumpman8947
jumpman8947

Reputation: 15

Excel OR IF statement

I have a drop down with three different choices. I'm trying to make the below cell have a question depending which drop down selection you choose. so far it works with one statement

=IF($B$2="A","First","").

That works, but when i add an or statement it does not work

=IF($B$2="A","First","") OR IF$B$2="B","Second","")

This does not work how can i change this so i cave this statement work for three choices with the formula in one cell.

Upvotes: 0

Views: 467

Answers (3)

Neil
Neil

Reputation: 125

The "nested ifs" is your best option.

=IF($B$2="A","First","")

=if($B$2=A,"condition 1","condition 2")

Condition 1 is true, i.e. $B$2=A Condition 2 is false, i.e. $B$2 does not equal <> A

The way to nest the ifs is to include it instead of "condition 1" or "condition 2".

So =if($B$2=A,if($B$2=B,"condition 2", "condition 3"),"condition 1")

$B$2=A and $B$2=B are both true then condition 2
$B$2=A is true but $B$2=B is not true then condition 3
$B$2=A is not true then condition 1

This is the logic behind nested ifs. You can expand this.

Upvotes: 0

Nasir
Nasir

Reputation: 11421

You cannot use OR function in Excel that way. Have a look at this: https://exceljet.net/excel-functions/excel-or-function

You could trying using nested IF statements OR you could use some other method (like a VLOOKUP)

Nested If would be something like this:

=IF($B$2='A', 'First', IF($B$2='B', "Second", ""))

Upvotes: 0

Tim Williams
Tim Williams

Reputation: 166511

=IF($B$2="A","First", IF($B$2="B", "Second", IF($B$2="C", "Third","???"))) 

or

=IFERROR(VLOOKUP(B3,{"A","First";"B","Second";"C","Third"},2,FALSE),"???")

Upvotes: 1

Related Questions