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

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
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,213,494
Messages
6,113,988
Members
448,538
Latest member
alex78

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