IF AND Formula with ISNUMBER

Chialiwa

New Member
Joined
Feb 15, 2018
Messages
27
I am writing a formula to categorize items based on item number but want any item that contains "IQF" in the description to have a different category. Anything containing the same item number range plus IQF in the description should say "IQF Vegetables". Here is the formula I'm using:

=IFS(AND(A2>199999,A2<300000),"Vegetables",AND(A2>199999,A2<300000,ISNUMBER(SEARCH("IQF",B2))),"IQF Vegetables")

1707776394075.png


Hoping this is something simple I'm overlooking. Thank you!
 

Attachments

  • 1707776024218.png
    1707776024218.png
    5.7 KB · Views: 6

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
It seems it would work better if you put the AND() with more conditions first, since the formula as it is stops at the first TRUE result and both match the first set of conditions before it even gets to looking for "IQF".
Test Sheet Summary.xlsx
ABC
1Item NumberItem DescriptionCategory
2200002OnionFirRstd3/8"DiceIQF,Org,PLIQF Vegetables
3200009Raisins,Thompson,Organic KSAVegetables
Sheet2
Cell Formulas
RangeFormula
C2:C3C2=IFS(AND(A2>199999,A2<300000,ISNUMBER(SEARCH("IQF",B2))),"IQF Vegetables",AND(A2>199999,A2<300000),"Vegetables")
 
Upvote 0
Solution
You only seem to be returning Vegetables or IQF Vegetables so it seems to me all you have to look for is IQF
=IF(ISNUMBER(SEARCH("IQF",B3)),"IQF ","")&"Vegetables"
 
Upvote 0
You only seem to be returning Vegetables or IQF Vegetables so it seems to me all you have to look for is IQF
=IF(ISNUMBER(SEARCH("IQF",B3)),"IQF ","")&"Vegetables"
Sorry, no, the string is huge and I'm returning many other things but didnt want to clog the thread with a huge formula. I apologize, I should have specified that. THe full formula is:

=IFS(AND(A2857>-1,A2857<79999),"FG",AND(A2857>80000,A2857<90000),"DTH",AND(A2857>99999,A2857<200000),"Dairy",AND(A2857>199999,A2857<300000),"Vegetables",AND(A2857>199999,A2857<300000,ISNUMBER(SEARCH("IQF",B2857))),"IQF Vegetables",AND(A2857>299999,A2857<400000),"Grains",AND(A2857>399999,A2857<500000),"Oils & Liquids",AND(A2857>499999,A2857<600000),"Spices",AND(A2857>599999,A2857<700000),"INT",AND(A2857>699999,A2857<800000),"PKG",A2857="000811F","FG")
 
Upvote 0
Full formula with the two Vegetable conditions swapped:
Excel Formula:
=IFS(AND(A2857>-1,A2857<79999),"FG",AND(A2857>80000,A2857<90000),"DTH",AND(A2857>99999,A2857<200000),"Dairy",AND(A2857>199999,A2857<300000,ISNUMBER(SEARCH("IQF",B2857))),"IQF Vegetables",AND(A2857>199999,A2857<300000),"Vegetables",AND(A2857>299999,A2857<400000),"Grains",AND(A2857>399999,A2857<500000),"Oils & Liquids",AND(A2857>499999,A2857<600000),"Spices",AND(A2857>599999,A2857<700000),"INT",AND(A2857>699999,A2857<800000),"PKG",A2857="000811F","FG")
 
Upvote 1
It seems it would work better if you put the AND() with more conditions first, since the formula as it is stops at the first TRUE result and both match the first set of conditions before it even gets to looking for "IQF".
Test Sheet Summary.xlsx
ABC
1Item NumberItem DescriptionCategory
2200002OnionFirRstd3/8"DiceIQF,Org,PLIQF Vegetables
3200009Raisins,Thompson,Organic KSAVegetables
Sheet2
Cell Formulas
RangeFormula
C2:C3C2=IFS(AND(A2>199999,A2<300000,ISNUMBER(SEARCH("IQF",B2))),"IQF Vegetables",AND(A2>199999,A2<300000),"Vegetables")

This worked!!!!!! Thank you SO much!!!!!!!
 
Upvote 0

Forum statistics

Threads
1,215,073
Messages
6,122,970
Members
449,095
Latest member
Mr Hughes

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