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: 8

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
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,223,911
Messages
6,175,337
Members
452,637
Latest member
Ezio2866

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