Share via

Check if a cell full of text contains either of multiple key words

Anonymous
2011-07-26T15:08:23+00:00

Background:

I often import large datalists from SAP into Excel to evaluate, sort and/or analyze costs.  In this data list, each row (of which there are many thousands) contains a variety of data, such as posting date, $ amount, and description of expense.  The description of expense is a text string, such as "Transmission repairs, oil chage", or "Replace tires, front brakes and rear springs".  I want to enter a formula that extract the corresponding $ amount only if the text string contains either of several specified "key words".

So Far:

After searching Excel Help, I found this example:

Check if part of a cell matches a specific text

Row  Column A

1        Data

2        Davolio

3        BD123

The example provides the Formula:   =IF(ISNUMBER(FIND("v",A2)),"OK","Not Ok")

Which checks to see if A2 contains the letter "v", which it does, so it returns the value "OK" in the target cell

My Attempt:

Lets use the following sample date for my situation:

Row  Col A             Col B          Col C

1        Date              $Amt          Description

2        22.06.2011    1,157.21    REPLACE BRAKE ROTORS/CALIPERS

3        24.06.2011    2,740.85    TRANSMISSION NOT DOWNSHIFTING

4        04.07.2011       499.80    OIL/FILTER CHANGE, TIRE ROTATION

In my case, I thought I could modify the FIND subfunction in the formula with an OR function to search a larger text string for multiple text expressions, so I tried this:

=IF(ISNUMBER(FIND(OR("BRAKE","TIRE"),A2)),B2,0)

Unfortunately, my modified formula above only returns the value "TRUE" in the target cell.  I confess, I do not understand the application of the ISNUMBER function in the use of evaluating a text string, so I really don't know where this is going wrong.

My bottom line need, is to be able to specify several "key word" text expressions, either in an OR function, or a lookup table, so that the presence of either of the keywords in the cell to be evaluated (col c) will return the corresponding dollar amount (col b) to the target cell (col D).

Would really appreciate some help.

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

HansV 462.6K Reputation points
2011-07-26T15:39:03+00:00

Try

=IF(SUM(--ISNUMBER(FIND({"BRAKE","TIRE"},C2))),B2,0)

Was this answer helpful?

0 comments No comments

Answer accepted by question author

Anonymous
2011-07-26T15:23:10+00:00

=IF(SUMPRODUCT(--(ISNUMBER(SEARCH({"BRAKE","TIRE"},A2))))>0,B2,0)

Was this answer helpful?

0 comments No comments

5 additional answers

Sort by: Most helpful
  1. Anonymous
    2011-07-26T15:50:36+00:00

    opps you are right it works only with brake, I didn't check it

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2011-07-26T15:30:27+00:00

    I am not too sure how your formula differs from the one posted by the OP? The issue that I see is that if you try to evaluate

    OR("BRAKE", "TIRE")

    the result is checking to see if either of those 2 words is true which really does not make sense and the formula falls apart from there. Since Both Find and Seach only take a single argument as the search string I do not see how to get around this without sumproduct or an array type formula....

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2011-07-26T15:20:55+00:00

    Hi, try

    =IF(ISNUMBER(FIND({"BRAKE","TIRE"},A1)),B2,0)

    Was this answer helpful?

    0 comments No comments