nested IF

jeff2000

New Member
Joined
Oct 26, 2005
Messages
9
I have three columns and a single row
A1 can have values 1,2,3,4
B1 can have values A,B,C,D
C1 =IF(B1=A,"X1",IF(B1=B,"X2",IF(B1=C,"X3",IF(B1=D,"X4"))))


When A1 is a value of 1 or 2 then this formula applies.

What I want to include in the above formula - if B1 is equal to A or B and A1 is equal to 3 or 4 then I want a blank.

1 A X1

I tried nesting the AND formula without success
Thanks for your help
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
jeff2000

I am not sure that I have got what you want in my mind, but try this in C1:
=IF(A1<3,LOOKUP(B1,{"A","B","C","D"},{"X1","X2","X3","X4"}),"")

You may want a further condition to check that A1 and B1 have data in them. Anyway, try the above for starters.
 
Upvote 0
Perhaps:

Code:
=IF((A1<3)*(A1<>"")*(B1<>""),"X" & CODE(UPPER(B1))-64,"")
 
Upvote 0
=IF(A1>2,"",IF(B1=A,"X1",IF(B1=B,"X2",IF(B1=C,"X3",IF(B1=D,"X4")))))

Peter's VLOOKUP approach, however, is probably more efficient

lenze
 
Upvote 0
MATCH would also work:

Code:
=IF(A1<3,"X" & MATCH(B1,{"A","B","C","D"},0),"")
 
Upvote 0

Forum statistics

Threads
1,224,394
Messages
6,178,342
Members
452,841
Latest member
GenAkaman

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top