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

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
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,214,864
Messages
6,121,986
Members
449,060
Latest member
mtsheetz

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