Search if cell contains one of many criteria then show ref # or ......

room99oat

New Member
Joined
Nov 11, 2015
Messages
14
Office Version
  1. 2019
Platform
  1. Windows
ABCDE
1Item nameTotal WeightlbCriterialb
2Dog lover40000=b2/e4Fish100
3So fishy20000=b3/e2Cat200
4Love bird30000=b4Dog300
5Super cat50000=b5/e3
6Big elephant1000=b6
7Small ant3000=b7

<tbody>
</tbody>

Hi, I need help for above tables.

How can I check if cells in column A contain criteria words in column E or not. And if it contains, I want the total weight on that cell divided by value of F column as shown on column C.

Thank you in advance.
 
Or this
=IFERROR(B2/LOOKUP(1,-SEARCH(D$2:D$4,A2),E$2:E$4),"")
 
Last edited:
Upvote 0

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
Just a comment:

9.99999999999999E+307 and 2^15 are hugely excessive but this does not affect anything.
The number should be >= the maximal expected value of SEARCH(substring,string).
So, for most practical purposes a 100 would be just enough.

It's

LOOKUP(MAX(reference)+DELTA,reference)

where DELTA a small positive number such that MAX(reference) < MAX(reference)+DELTA.

Although this will yield the last numeric value from reference, it's not desirable on two counts:

[1] Slow because MAX examines every cell of reference.
[2] MAX is sensitive to the error values like #N/A in reference.

The big number

9.99999999999999E+307

is a limit value of Excel itself. It's quite improbable that this value will ever occur anywhere in reference. Thus there won't be any need to guess what would be a suitable number for a given reference whenever we are after the last numeric value. So there is no need for any of the zillions variations like 2^15, 99^99, 1E100, etc. etc.

[3] We know that LOOKUP and kindred functions ignore error values if they possibly can (they are designed that way).
[4] LOOKUP (and kindred functions with match-type TRUE or 1) appear to recruit (a form of) the binary search algorithm, which is very fast.

Here are some relevant links on the matter:
http://www.mrexcel.com/forum/excel-questions/102091-9-9999999-a.html
http://www.mrexcel.com/forum/excel-...tiple-matches-match-returned.html#post1523998

Given 1 to 4, we have formulas like...

=LOOKUP(9.99999999999999E+307,A:A)

=IFERROR(B2/LOOKUP(9.99999999999999E+307,SEARCH($D$2:$D$4,A2),$E$2:$E$4),"")
 
Upvote 0

Forum statistics

Threads
1,214,627
Messages
6,120,610
Members
448,973
Latest member
ChristineC

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