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
30 kg bag in GrainProGrainPro Bags
30 kg vacuum package#Value!

<tbody>
</tbody>

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

Thank you,

Evan
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
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
30 kg bag in GrainProGrainPro Bags
30 kg vacuum package#VALUE !

<tbody>
</tbody>

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,215,389
Messages
6,124,665
Members
449,178
Latest member
Emilou

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