User Defined Function - look for specific value above current cell

alfordtp

Board Regular
Joined
Oct 3, 2008
Messages
62
I have the following Data Set:[TABLE="class: grid, width: 500, align: center"]
<tbody>[TR]
[TD]1[/TD]
[TD]Brand[/TD]
[TD]ABC[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]MFG[/TD]
[TD]Apple[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD][/TD]
[TD]Overivew1[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD][/TD]
[TD]Overview2[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]Brand[/TD]
[TD]DEF[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]MFG[/TD]
[TD]Peach[/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD][/TD]
[TD]Overview1[/TD]
[/TR]
[TR]
[TD]8[/TD]
[TD][/TD]
[TD]Overview2[/TD]
[/TR]
[TR]
[TD]9[/TD]
[TD]Brand[/TD]
[TD]XYZ[/TD]
[/TR]
[TR]
[TD]10[/TD]
[TD]MFG[/TD]
[TD]Grape[/TD]
[/TR]
[TR]
[TD]11[/TD]
[TD][/TD]
[TD]Overview1[/TD]
[/TR]
[TR]
[TD]12[/TD]
[TD][/TD]
[TD]Overview2[/TD]
[/TR]
</tbody>[/TABLE]

I need a user defined function that will look up the brand and place it in the blank cells. In the above example, the blank cells in rows 3 and 4 would say "Apple" for the brand. "Peach" would go in rows 7 and 8, and "Grape" would go in rows 11 and 12. The brand is not always two rows above the first overview cell, so it needs to go up until it reaches brand and save that as the value for the blank cell.

Hope I'm explaining this enough. Let me know if there are any questions. Thanks in advance.

Tim
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Is MFG always in the cell next to the value you want in the empty cells?
 
Upvote 0
yes, that is true. In reference to the active cell (blank cell), the MFG is always above it. there may be other information between it though. I modified the table to show this.

[TABLE="class: cms_table_grid, width: 500, align: center"]
<tbody>[TR]
[TD]1[/TD]
[TD]Brand[/TD]
[TD]ABC[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]MFG[/TD]
[TD]Apple[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD][/TD]
[TD]Overivew1[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD][/TD]
[TD]Overview2[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]Brand[/TD]
[TD]DEF[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]MFG[/TD]
[TD]Peach[/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD]Ordercode[/TD]
[TD]231[/TD]
[/TR]
[TR]
[TD]8[/TD]
[TD][/TD]
[TD]Overview1[/TD]
[/TR]
[TR]
[TD]9[/TD]
[TD]Brand[/TD]
[TD]XYZ[/TD]
[/TR]
[TR]
[TD]10[/TD]
[TD]MFG[/TD]
[TD]Grape[/TD]
[/TR]
[TR]
[TD]11[/TD]
[TD][/TD]
[TD]Overview1[/TD]
[/TR]
[TR]
[TD]12[/TD]
[TD][/TD]
[TD]Overview2[/TD]
[/TR]
</tbody>[/TABLE]


Basically I want the Brand to show up in all cells next to the "overview" cells. Since there will be multiple brands, it should reflect the brand that it first encounters going upward.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,822
Messages
6,181,165
Members
453,021
Latest member
Justyna P

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