Search cells to see if it contains text from list and return name of list

tuxbird

New Member
Joined
Jul 27, 2016
Messages
3
Hi,

I have several lists e.g.

Colors
Red
Blue
Green
Yellow

Shapes
Round
Square
Rectangular

Where I have named the cells so the first list is called Colors and the second list is called Shapes.

Then I have a table that looks like:

TYPE COST REVENUE
Round 15 45
Square 10 20
Green 8 16

I want to search in the column "TYPE" to see which list the "TYPE" text is part of so the result would be:

TYPE COST REVENUE CATEGORY
Round 15 45 Shape
Square 10 20 Shape
Green 8 16 Color

Can anyone help me with this?

Thanks
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
=if(ISNUMBER(MATCH(A2,D:D,0)),"Colors",if(ISNUMBER(A2,E:E,0)),"Shapes",""))

Assuming you have colors in Col D and Shapes in Col E
 
Upvote 0
=if(ISNUMBER(MATCH(A2,D:D,0)),"Colors",if(ISNUMBER(A2,E:E,0)),"Shapes",""))

Assuming you have colors in Col D and Shapes in Col E

The OP has named ranges, so this should work:

=if(ISNUMBER(MATCH(A2,Colors,0)),"Colors",if(ISNUMBER(A2,Shapes,0)),"Shapes",""))
 
Upvote 0
Thanks for your help.

I can get it to work but only for one of the lists

=if(ISNUMBER(MATCH(A2,Colors,0)),"Colors")

When I use more than one I get the error: "Too many arguments were entered for this formula"

Am I doing something wrong?
 
Upvote 0
=if(ISNUMBER(MATCH(A2,Colors,0)),"Colors",if(ISNUMBER(MATCH(A2,Shapes,0)),"Shapes",""))
 
Upvote 0

Forum statistics

Threads
1,215,511
Messages
6,125,250
Members
449,218
Latest member
daynle

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