ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   VLOOKUP, but different (https://www.excelbanter.com/excel-worksheet-functions/186357-vlookup-but-different.html)

Cooz

VLOOKUP, but different
 
Hi everyone,

I have a table on Sheet1 with strings in column A. Say for simplicity's sake
that they are colours.

A
red
blue
purple
yellow
black

In addition I have this macro, that, when run, reads rows on a table on
Sheet2 and fills B1 on Sheet1 with the contents of the fourth cell in the
read row. As soon as the value of B1 changes, I need to determine whether B1
_contains_ a string that is present in column A. In this case the found value
in column A should be copied to C1.

For example: The macro runs. B1 gets this value: "no cure for the blues". C1
should have the value "blue". The macro processes the next line. B1 gets this
value: "movies by peter greenaway" C1 should become blank. The macro
processes the next line. B1 gets this value: "boredom". C1 should get the
value "red".

I know how to do this in code, but this slows down the macro considerably.
Is there a worksheet function that I can place in C1 which does the trick,
and if so: which one? Perhaps some fancy use of SUMPRODUCT?

Thank you,
Cooz


Herbert Seidenberg

VLOOKUP, but different
 
This finds multiple matches in string:
http://www.savefile.com/files/1542738


All times are GMT +1. The time now is 03:44 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com