Vlookup for data (yield only numeric values)

AlGuy

New Member
Joined
Mar 1, 2012
Messages
37
I am working on a spreadsheet and need to automate data reporting. I update the spreadsheet with data on a daily basis.

Consider the table below:

[TABLE="width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]Wednesday, December 26, 2012[/TD]
[TD]6300[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]Thursday, December 27, 2012[/TD]
[TD]NC[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]Friday, December 28, 2012[/TD]
[TD]NC
[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]Monday, December 31, 2012[/TD]
[TD]6200[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]Wednesday, January 02, 2013[/TD]
[TD]NC
[/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD]Thursday, January 03, 2013[/TD]
[TD]6080[/TD]
[/TR]
[TR]
[TD]8[/TD]
[TD]Friday, January 04, 2013[/TD]
[TD]6090
[/TD]
[/TR]
[TR]
[TD]9[/TD]
[TD]Monday, January 07, 2013[/TD]
[TD]NC
[/TD]
[/TR]
</tbody>[/TABLE]

I want to get the last 2 Fridays' value. And in case the value of a Friday is not a numeric value (so the cell contains "NC"), the formula should take the closest value going up. In the example below, the formula should yield:
- for the most recent Friday (January 4 2013): 6090 (A basic vlookup formula should work fine here: In B1, I add the date and use the formula: VLOOKUP($B$1,Cours!$1:$1048576,2,FALSE)).
- for the Friday before the most recent: 6300 (The value for that Friday is NC, but since it's not a number, the formula should look for the most recent numeric value which occurred on December 26, 2012). The previous formula would have return "NC", which is not helpful for my calculations.

Thank you to anyone who can help me with solving this issue.
 

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