Using OR in SEARCH String

Whylucky

New Member
Joined
Sep 24, 2013
Messages
39
Hi All,

So i wrote an excel equation to spit out a date based on 2 criteria. If it has a 1, 2, or 4 in one column then an A, B, or C in the next column it gives a result. Then if it has a 5, 6, or 7 in another column and a A, B, or C it gives a certain result. I have the equation done other than i need a way to search for 1, 2 or 4 and i can not find a way to search multiple options. I highlighted the section that needs to be adjusted, does anyone have any suggestions?

P.S. In the first searched column numbers are not the only thing contained in the searched cells

EQUATION:
Code:
=IF(IFERROR([COLOR=#ff0000]SEARCH("1",$Q2),0)[/COLOR],IF(IFERROR(SEARCH("A=",$P2),0),DATE(YEAR(S2),MONTH(S2),DAY(S2)-20),IF(IFERROR(SEARCH("B=",$P2),0),DATE(YEAR(S2),MONTH(S2),DAY(S2)-25),IF(IFERROR(SEARCH("C=",$P2),0),DATE(YEAR(S2),MONTH(S2),DAY(S2)-80),"-"))),IF(IFERROR([COLOR=#ff0000]SEARCH("5",$Q2),0)[/COLOR],IF(IFERROR(SEARCH("A=",$P2),0),DATE(YEAR(S2),MONTH(S2),DAY(S2)-49),IF(IFERROR(SEARCH("B=",$P2),0),DATE(YEAR(S2),MONTH(S2),DAY(S2)-61),IF(IFERROR(SEARCH("C=",$P2),0),DATE(YEAR(S2),MONTH(S2),DAY(S2)-80),"-"))),"-"))
 
Last edited:

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
A couple of possibilities:

SUM(COUNTIF($Q2,{"*1*","*2*","*4*"}))

SUM(--ISNUMBER(SEARCH({"1","2","4"},$Q2)))
 
Upvote 0
Thanks I used the first option, i tried to do a SEARCH({"1","2","3"},$Q2) and it wouldnt return a value is there a reason for this?
 
Upvote 0
Yea i noticed that when i was typing it up, what would it take to make that work, for future reference?
 
Upvote 0

Forum statistics

Threads
1,215,884
Messages
6,127,565
Members
449,385
Latest member
KMGLarson

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