Hi gurus!
I have run into a problem that i feel should be easier to solve than it seems.
Scenario: I have a spreadsheet that is using a given date to show numbers from that date by referencing a day-by-day report. Most values can be gotten by using VLOOKUP but there is a problem.
One value i need to get returned from the report is the End Of Month date based on the given date (i.e. if i enter 2014-04-25 it should give me 2014-04-30). This works fine by just using the EOMONTH-function in Excel.
However, for a specific data-report, each month is not listed as the calendar month but rather a custom length where each months always have 7-day weeks.
In the attached example file i have noted that on "Sheet1", in cell B5 i enter a date and based on that date cell B2 should return the End Of Month date.
On "Sheet2" i have listed an example of two months and how they are listed in the data-report that is to be used to return the date in B2. As you can see, months end on different dates so EOMONTH cannot be used.
I then tried using HLOOKUP in this kind of formula: =HLOOKUP("Month"&" "&TEXT(I3;"[$-409]MMMM");'Sheet2'!$A:$B;9;FALSE). The lookup works so that it finds the cell called "Month XXXX" but then i need to get the formula to step upwards and return the first date it finds. Here is where i can't figure out how to do it since it isn't always the first cell above the cell "Month XXXX", it will be either the First or the Second one.
My thought is, can the "row_index_num" part of HLOOKUP be entered in the form of a formula or must it always be a number? Or do you have something completely differnt to suggest?
I hope you guys can help!
Bookmarks