Need help with Syntax with IF OR

lgia

New Member
Joined
Aug 22, 2011
Messages
18
I am having problems with trying to get this function to work. The Search function in the command seems to require a different format.

Basically I am checking a long GL string,
If $A2 contains 509 fill the cell with 509,
If $A2 contains 511 fill the cell with 511,
If $A2 contains 510 fill the cell with 510, else fill the cell with the contents of $A2

This command works for 1 if, but when I add the OR and try to do a string of Ifs it doesn't work.

=IF(OR(ISNUMBER(SEARCH(509,$A2)),509),ISNUMBER(SEARCH(511,$A2)),511),ISNUMBER(SEARCH(510,$A2)),510,$A2)))
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
not sure what this is doing
OR(ISNUMBER(SEARCH(509,$A2)),509)
as its closing the OR

=IF(ISNUMBER(SEARCH(509,$A2)),509, IF(ISNUMBER(SEARCH(511,$A2)),511,IF(ISNUMBER(SEARCH(510,$A2)),510,$A2)))
 
Upvote 0

Forum statistics

Threads
1,215,606
Messages
6,125,800
Members
449,261
Latest member
Rachel812321

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