Search a list, return value based on partial text

edam4i

New Member
Joined
Jul 28, 2018
Messages
11
Hi would appreciate any help here please.

  • I want to paste in financial transactions into Col A
  • Have them automatically categories in Col B
  • Based on a list in Col H
  • The ist will have partial text
Hope I explained sufficiently, if not please let me know.
Thanks,
C.
 

Attachments

  • Screenshot 2022-08-01 at 20.55.35.png
    Screenshot 2022-08-01 at 20.55.35.png
    58.4 KB · Views: 23
  • Screenshot 2022-08-01 at 20.55.35.png
    Screenshot 2022-08-01 at 20.55.35.png
    58.4 KB · Views: 21

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Not completely sure this is what you're after, but try this in B3 filled down. Adjust your ranges as needed.

=INDEX($G$3:$G$7,LOOKUP(9E+307,SEARCH($H$3:$H$7,A3)))
 
Upvote 0
Not completely sure this is what you're after, but try this in B3 filled down. Adjust your ranges as needed.

=INDEX($G$3:$G$7,LOOKUP(9E+307,SEARCH($H$3:$H$7,A3)))
Thanks, could you tell me what the meaning of 9E+307 is please so I can better understand the code.
Thanks,
 
Upvote 0
After looking at the results while trying to write up an explanation, my formula does not work properly. Amazingly, it only works based on the order of your sample data. If you re-arrange the values in column A, it stops working.

ALDI and LIDL return GROCERIES because the LOOKUP function is returning a 1 - but that '1' is from the position of the partial match in the string, not the position of the array returned by the SEARCH function. "ALD" and "LID" are found starting in position 1 of "ALDI" and "LIDL", respectively.

Same applies to VODAFONE ("OFA" is found in position 3, hence the third value, INTERNET, is returned. For NETFLIX, "FLIX" is in position 4 and for STARBUCKS, "BUCKS" is in position 5. So in each example it "successfully" match the correct row. Now I've seen it all, haha.

So some work still needs to be done with this one, but back to your original question about 9E+307...

9E+307 is a very, very large number (exponential notation, equivalent to 9 followed by 307 zeros) - greater than any number anyone is likely to enter into a cell. If LOOKUP doesn't find an exact match to that number it will return the next largest number it finds in the range/array. See the Excel help files for its usage, limitations and more details about how the function works.
 
Upvote 0
After looking at the results while trying to write up an explanation, my formula does not work properly. Amazingly, it only works based on the order of your sample data. If you re-arrange the values in column A, it stops working.

ALDI and LIDL return GROCERIES because the LOOKUP function is returning a 1 - but that '1' is from the position of the partial match in the string, not the position of the array returned by the SEARCH function. "ALD" and "LID" are found starting in position 1 of "ALDI" and "LIDL", respectively.

Same applies to VODAFONE ("OFA" is found in position 3, hence the third value, INTERNET, is returned. For NETFLIX, "FLIX" is in position 4 and for STARBUCKS, "BUCKS" is in position 5. So in each example it "successfully" match the correct row. Now I've seen it all, haha.

So some work still needs to be done with this one, but back to your original question about 9E+307...

9E+307 is a very, very large number (exponential notation, equivalent to 9 followed by 307 zeros) - greater than any number anyone is likely to enter into a cell. If LOOKUP doesn't find an exact match to that number it will return the next largest number it finds in the range/array. See the Excel help files for its usage, limitations and more details about how the function works.
Ok thank you for your effort and explanation too. If you can develop this that would be great if you can't please just let me know and I'l try somewhere else. Thanks again!
 
Upvote 0
This formula may work better (hopefully). Give it a shot.

=INDEX($G$3:$G$7,MATCH(TRUE,ISNUMBER(SEARCH($H$3:$H$7,A3)),0))
 
Upvote 0

Forum statistics

Threads
1,215,825
Messages
6,127,111
Members
449,359
Latest member
michael2

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