Help with IFS Search formula

Evans2

Board Regular
Joined
Jun 11, 2015
Messages
56
Hi all,

I have a column with text that I need to extract into another column. I'm using an IFS(Search) formula to do this which is working for some of the text in my first logical test but not the second even though the text is present.

formula
=IFS(SEARCH("GrainPro",M92),"GrainPro Bags",SEARCH("vacuum package",M92),"vacuum package")

result
[TABLE="width: 200"]
<tbody>[TR]
[TD]30 kg bag in GrainPro[/TD]
[TD]GrainPro Bags[/TD]
[/TR]
[TR]
[TD]30 kg vacuum package[/TD]
[TD]#Value![/TD]
[/TR]
</tbody>[/TABLE]

I'm not sure why it's not working for me. Any help is appreciated!

Thank you,

Evan
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
Hi all,

I have a column with text that I need to extract into another column. I'm using an IFS(Search) formula to do this which is working for some of the text in my first logical test but not the second even though the text is present.

formula
=IFS(SEARCH("GrainPro",M92),"GrainPro Bags",SEARCH("vacuum package",M92),"vacuum package")

result
[TABLE="width: 200"]
<tbody>[TR]
[TD]30 kg bag in GrainPro[/TD]
[TD]GrainPro Bags[/TD]
[/TR]
[TR]
[TD]30 kg vacuum package[/TD]
[TD]#VALUE ![/TD]
[/TR]
</tbody>[/TABLE]

I'm not sure why it's not working for me. Any help is appreciated!

Thank you,

Evan

It's because if the first condition is not true, it's returning an error, and doesn't run the else statement. Use If error to make the error return 0 instead. See below

=IF(IFERROR(SEARCH("GrainPro",M92)>0,0),"GrainPro Bags",IF(IFERROR(SEARCH("vacuum package",M92)>0,0),"vacuum package"))

For an if statement, you want the first condition to return true or false, or 1 or 0. Search("GrainPro", M92) will return #VALUE ! if grainpro is not in the cell, so for instances where that text is not present, we want it to return 0 instead of a value error, because when 0 is returned the if statement, knows it's time to run the value if false portion.
 
Last edited:
Upvote 0
It's because if the first condition is not true, it's returning an error, and doesn't run the else statement. Use If error to make the error return 0 instead. See below

=IF(IFERROR(SEARCH("GrainPro",M92)>0,0),"GrainPro Bags",IF(IFERROR(SEARCH("vacuum package",M92)>0,0),"vacuum package"))

For an if statement, you want the first condition to return true or false, or 1 or 0. Search("GrainPro", M92) will return #VALUE ! if grainpro is not in the cell, so for instances where that text is not present, we want it to return 0 instead of a value error, because when 0 is returned the if statement, knows it's time to run the value if false portion.


Thank you!!!
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,848
Members
452,361
Latest member
d3ad3y3

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