xcelnovice

Board Regular
Joined
Dec 31, 2011
Messages
81
Hi I am trying to write an IF statement
So far I have IF(OR(A1=“A”,A1=“C”),”1”,”2”)
I’d like to add 2 more statements like this
So if A1=B or D return values 3 & 4 and If A1=E or F return 5 & 6
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Hi.

What exactly do you mean by this
So if A1=B or D return values 3 & 4
?

Do you mean, if A1=B, return 3, and if A1 = D, return 4 ?
Or do you mean, If A1 = B or D, return the text string "3 & 4" ?
 
Upvote 0
Sorry the first one. If A1=B return 3 & if A1=D return 4. And I’d like it to be all one formula so no matter if A1= A,B,C,D,E,F it returns one of the numbers. Hope this is clear. Sorry can’t post a file from my phone Thanks
 
Upvote 0
OK, I think your best bet would probably be a look up table.

Set up a range somewhere like this, across 2 columns, let's assume you do it in the range D1:E6
A........1
B........3
C........2
D........4
E........5
F........6

Then, instead of your existing formula, use something like

=vlookup(A1,D1:E6,2,false)

It is possible to do this other ways - for example an IF statement, but this will rapidly get complicated, or you can also embed the lookup table within a formula, *** Edit to add - like 63falcondude did :) *** but my personal preference is not to do that.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,053
Messages
6,122,882
Members
449,097
Latest member
dbomb1414

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