I have a basic financial spreadsheet that I am trying to make even nicer. I have a table that looks like this:
| Description | Category | Amount
| 2341234 Chick-fil-a | Eating Out | 5.89
| 11234 Redbox/Georgetown | Entertainment | 1.21
And another table that looks like this:
| Name | Category |
| Chick-fil-a | Eating out |
| Redbox | Entertainment |
I want to find the strings from the first column of the second table in the first column of the first table and automaically populate the second column of the first table. I am pretty sure I can find the position of the string by doing a {=find(2ndSheet!A:A,1stSheetA:A)} or something of the like, but I have no idea how to populate another cell based off of that.
Does it have to be a macro?
This is a bit ugly but seems to work. It handles the situation where your description may not necessarily match the lookup table (for instance, with Redbox | Redbox/Georgetown). Replace the
[Lookup_Table]with the absolute range of your lookup table, and enter as an array formula (Control+Shift+Enter):As for what it’s doing:
It’s using an
INDEXformula with the [Lookup_Table] as the base range. For the row to match, it looks for instances where running theFINDformula using the current cell does not cause an error. So in the case ofRedbox, you’d get an array like{#VALUE!, 7}. You then set the values toTRUE/FALSEbased on whether they are errors, and then flip them so that non-errors areTrue. You then match theTRUEcondition against that array, and a hit will return the row number in your lookup table. You then use that row number and column 2 to find the corresponding value.Again, that is not a pretty one (and there is probably a better way to handle all of your cases), but it seems to work in my extremely exhaustive test of three rows 🙂