Populate cells if value "contains" a values in a look-up table

sshaffer99

Board Regular
Joined
Sep 29, 2010
Messages
111
Hi,

This may be too complicated for this forum, but I thought I'd ask.
I was wondering if someone can help me to create a button which will be available on every row and populate an income or expense category based on a look-up table.

Sample of My Spreadsheet:

Row B
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Transaction[/TD]
[TD]Amount[/TD]
[TD]Expense Category[/TD]
[TD]Income Category[/TD]
[/TR]
[TR]
[TD]Button[/TD]
[TD]Patter Exxon Main[/TD]
[TD]-25.00[/TD]
[TD]Fuel[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Button[/TD]
[TD]Expo Salary[/TD]
[TD]250.00[/TD]
[TD][/TD]
[TD]Services[/TD]
[/TR]
[TR]
[TD]Button[/TD]
[TD]Broad St Outback[/TD]
[TD]-32.00[/TD]
[TD]Meals[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Button[/TD]
[TD]East Fed Ex Prime[/TD]
[TD]6.50[/TD]
[TD]Postage[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

I will have a look-up table (sample below) with Keywords in the first column and a Category in the 2nd column.

In the table displayed above, Column B has transactions from a downloaded bank statement. When a button in row A is pressed, I'd like to see if B "contains" a value in the lookup table. If the keyword is found, populate D or E with the Category from the lookup table.
If the value in "C" is a positive number, populate column E with the category.
If the value in "C" is a negative number, populate column D with the category.
If D or E is already populated (not blank), do nothing (do not over-write value).

For Example,
if Column B contains "Exxon", populate Column "D" with "Fuel".
If Column B contains "Salary", populate Column "E" with "Services"
If Column B contains "Fed Ex", populate column "D" with "Postage"

Sample Look-up Table:

[TABLE="class: grid, width: 500, align: left"]
<tbody>[TR]
[TD]Keyword[/TD]
[TD]Category[/TD]
[/TR]
[TR]
[TD]Exxon[/TD]
[TD]Fuel[/TD]
[/TR]
[TR]
[TD]Salary[/TD]
[TD]Services[/TD]
[/TR]
[TR]
[TD]Fed Ex[/TD]
[TD]Postage[/TD]
[/TR]
</tbody>[/TABLE]

I know how to create a button in Column A, and I know how to create some very basic code for the button, but need help with the above.

Thanks in advance!
 
Correction - Instead of having 2 category columns, one for income and one for expense, I will have 1 column for all categories. So I do not need the functionality to determine if column C is a positive or negative number. All categories will be populated in column D above.
 
Upvote 0

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