IF Search formula only works for the first 2

Jossilyns

New Member
Joined
Nov 17, 2021
Messages
5
Office Version
  1. 365
Platform
  1. Windows
Hi All,

I am using the following formula in Excel Subscription product 365 to return a text value in the adjacent cell:

=IF(B11="","",
IF(SEARCH("FNQ",B11),"FNQ",
IF(SEARCH("NQ",B11),"NQ",
IF(SEARCH("FWQ",B11),"FWQ",
IF(SEARCH("CQ",B11),"CQ",
IF(SEARCH("WBB",B11),"WBB",
IF(SEARCH("SWQ",B11),"SWQ",
IF(SEARCH("SEQ",B11),"SEQ",""))))))))

It works for the first 2 returning Blank or FNQ but for all the other ones it returns #VALUE error.

Can someone please 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.
Your formula looks ok, however, if you expect some other input, then I suggest you post some sample data in which this formula is not working. Use XL2BB. If you need instructions, look at my signature. Do not post a picture as we cannot manipulate data in a picture.
 
Upvote 0
Welcome to the Forum!

Your #VALUE error is because the first SEARCH() will return #VALUE unless B11 contains "FNQ".

Try: =LET(s,{"FNQ","NQ","FWQ","CQ","WBB","SWQ","SEQ"},IFERROR(INDEX(s,MATCH(TRUE,ISNUMBER(SEARCH(s,B11)),)),""))
 
Upvote 0
WHS Training Register.xlsx
ABC
3PositionLocationRegion
5Frequency of training
6Execution of training
7Requirement:- Refer QBuild WHS Minimum Compentency Standard (PRO322)
8EmployeeLocation
9ALLEN, PETERFNQ Thursday IslandFNQ
10ANDERSON, GAVINNQ Garbutt (TSV office)#VALUE!
11ATKINSON, ALANFWQ Normanton#VALUE!
12BENNETT, TERRENCE (AGENCY)FNQ Tolga/AthertonFNQ
13BLAIN, CHRISTOPHERSWQ Roma#VALUE!
14BOWDITCH, BOBBY 
15BOYD, ROBERTCQ Rockhampton#VALUE!
FS WHS Training
Cell Formulas
RangeFormula
C9:C15C9=IF(B9="","", IF(SEARCH("FNQ",B9),"FNQ", IF(SEARCH("NQ",B9),"NQ", IF(SEARCH("FWQ",B9),"FWQ", IF(SEARCH("CQ",B9),"CQ", IF(SEARCH("WBB",B9),"WBB", IF(SEARCH("SWQ",B9),"SWQ", IF(SEARCH("SEQ",B9),"SEQ",""))))))))
Cells with Data Validation
CellAllowCriteria
B9:B15List='Set up Info'!$B$9:$B$62
 
Upvote 0
Welcome to the Forum!

Your #VALUE error is because the first SEARCH() will return #VALUE unless B11 contains "FNQ".

Try: =LET(s,{"FNQ","NQ","FWQ","CQ","WBB","SWQ","SEQ"},IFERROR(INDEX(s,MATCH(TRUE,ISNUMBER(SEARCH(s,B11)),)),""))
That works! much appreciated!
 
Upvote 0
I was guessing FNQ etc made you a Queenslander!

If your data always follows this format, you could simplify to:

m
AB
1FNQ Thursday islandFNQ
2NQ Garbutt (TSV office)NQ
3 
4SWQ RomaSWQ
Sheet3
Cell Formulas
RangeFormula
B1:B4B1=IFERROR(LEFT(A1,FIND(" ",A1)-1),"")
 
Upvote 0
Try this

Book1
ABC
8EmployeeLocation
9ALLEN, PETERFNQ Thursday IslandFNQ
10ANDERSON, GAVINNQ Garbutt (TSV office)NQ
11ATKINSON, ALANFWQ NormantonFWQ
12BENNETT, TERRENCE (AGENCY)FNQ Tolga/AthertonFNQ
13BLAIN, CHRISTOPHERSWQ RomaSWQ
14BOWDITCH, BOBBY 
15BOYD, ROBERTCQ RockhamptonCQ
Sheet1
Cell Formulas
RangeFormula
C9:C15C9=LOOKUP(0,-SEARCH({"*","NQ","CQ","FNQ","FWQ","WBB","SWQ","SEQ"},B9&"*"),{"","NQ","CQ","FNQ","FWQ","WBB","SWQ","SEQ"})
 
Upvote 0

Forum statistics

Threads
1,223,099
Messages
6,170,114
Members
452,302
Latest member
TaMere

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