if count and seach criteria. (find part of value en a cells and return with a certain value)

muggi

New Member
Joined
Sep 22, 2004
Messages
38
Hi,
i have below formula, that search a certain cell (c8), and if found any of the search criteria , it should return a value.

=IF(COUNT(SEARCH({"harald";"fakta";"coop";"bilka"};C8));"m";IF(ISNUMBER(SEARCH({"stof";"babysam"};C8));"d";IF(ISNUMBER(SEARCH({"læge";"fysioterapeut"};C8));"L";"")))

But is it possible to change this:

({"harald";"fakta";"coop";"bilka"} and also the 2 other criteria

to a range of cells (each cell with 1 criteria) containing the search criteria, that way it would be easier to maintain the data.
BUT the formula should still be able to seach the C8 and look if part of the value in C8 contains the criteria?

Is it possible ?
 

Some videos you may like

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).

XOR LX

Well-known Member
Joined
Jul 2, 2012
Messages
4,517
Hi,

Sure. With e.g. B1:B4 containing "harald","fakta","coop","bilka", C1:C2 containing "stof","babysam" and D1:D2 containing "læge","fysioterapeut":

=IF(COUNT(LOOKUP(32^19,SEARCH(B1:B4,C8))),"m",IF(COUNT(LOOKUP(32^19,SEARCH(C1:C2,C8))),"d",IF(COUNT(LOOKUP(32^19,SEARCH(D1:D2,C8))),"L","")))


Regards
 

muggi

New Member
Joined
Sep 22, 2004
Messages
38
Thank you very much for the help and fast reply. Always people in here taking their time to help others :)

I don't understand what the 32^19 does, but hey it works :)
 

XOR LX

Well-known Member
Joined
Jul 2, 2012
Messages
4,517
You're welcome!

(It's just an arbitrarily, though also sufficiently, large number! :))
 

Watch MrExcel Video

Forum statistics

Threads
1,122,551
Messages
5,596,797
Members
414,103
Latest member
imamalidadashzada

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
Top