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.
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.