Share via

search string and return adjacent value.

Anonymous
2017-07-14T20:37:48+00:00

I am using the following array formula to search a range (HTS_COMBO) for a number and return the adjacent cell in another range (item_nums). Column Q contains just a numerical list (1,2,3,4,5,6...) starting at row 8.

(array formula)

=INDEX(ITEM_NUMS,SMALL(IF(HTS_COMBO=J$4,ROW(HTS_COMBO)-MIN(ROW(HTS_COMBO))+1),Q8))

My lookup range (hts_combo) has a series of numbers. Some of the numbers have two sets of numbers in one cell. If, J$4 contains 1806900073, then currently it doesn't recognize it. I need to it search the entire string for a match regardless of the place. 

Sample of how HTS_Combo range looks.

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

Ashish Mathur 101.9K Reputation points Volunteer Moderator
2017-07-14T23:51:57+00:00

Hi,

Try this array formula

=INDEX(ITEM_NUMS,SMALL(IF(ISNUMBER(SEARCH(J$4,HTS_COMBO)),ROW(HTS_COMBO)-MIN(ROW(HTS_COMBO))+1),Q8))

Was this answer helpful?

0 comments No comments

3 additional answers

Sort by: Most helpful
  1. Anonymous
    2017-07-17T14:55:31+00:00

    Thanks!

    This works....

    When I make my first million..... I'm buying you a Krystal WITH cheese!

    (...or White Castle if you prefer)

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2017-07-17T14:54:44+00:00

    Thanks. But this would only pull the left number (first 10 digits). I needed it to look up both if there was more than one in the string.

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2017-07-14T20:41:07+00:00

    How about

    =INDEX(ITEM_NUMS,SMALL(IF(HTS_COMBO=left(J$4,10),ROW(HTS_COMBO)-MIN(ROW(HTS_COMBO))+1),Q8))

    best wishes

    Was this answer helpful?

    0 comments No comments