Need help with a formula I am trying to create

zero20

New Member
Joined
Oct 7, 2022
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Hello, I am trying to create a formula that will automatically assign categories to our online products based on the values in another cell

Here's an example of what I've been trying, but it does not work because it only returns the first value that it successfully matches. I need it to return all matched values.

="default category"&IF(OR(ISNUMBER(SEARCH({"shirts"},A2))),",category 1",IF(OR(ISNUMBER(SEARCH({"blouses"},A2))),",category 2",IF(OR(ISNUMBER(SEARCH({"dresswear"},A2))),",category 3")))

("default category" is a fixed value that needs to always be at the beginning of this cell)

The result I get with this formula:

product typecategories
shirts|blouses|dressweardefault category,category 1

The result I am trying to get:

product typecategories
shirts|blouses|dressweardefault category,category 1,category 2,category 3

Any help or advice is greatly appreciated. Thank you :)
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
try this:
Excel Formula:
="default category"&IF((ISNUMBER(SEARCH({"shirts"},A2))),",category 1", "")&IF((ISNUMBER(SEARCH({"blouses"},A2))),",category 2","")&IF(OR(ISNUMBER(SEARCH({"dresswear"},A2))),",category 3","")
 
Upvote 0
Solution
try this:
Excel Formula:
="default category"&IF((ISNUMBER(SEARCH({"shirts"},A2))),",category 1", "")&IF((ISNUMBER(SEARCH({"blouses"},A2))),",category 2","")&IF(OR(ISNUMBER(SEARCH({"dresswear"},A2))),",category 3","")
This worked, thank you so much :)
 
Upvote 0

Forum statistics

Threads
1,214,911
Messages
6,122,192
Members
449,072
Latest member
DW Draft

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