Home » excel » date – Get cell to the right of current month in Excel

date – Get cell to the right of current month in Excel

Posted by: admin May 14, 2020 Leave a comment

Questions:

I’m pretty new to Excel, that question is probably easy, but I dont know what to do :-(.
So this is what I have:

Date        Numbers
01.09.11      10   
01.10.11      20
01.11.11      30
01.12.11      40

Now what I want is in another cell: Get the number of the date, where the date’s month is the current month. How do I do this?

How to&Answers:

Assuming all your dates are strings of the form “dd.mm.yy”, you can use the following array formula:

=INDEX(B1:B4,MATCH(9,VALUE(MID(A1:A4,4,2)),0))

where the 9 is the month number you want to look up. Enter this as an array formula by pressing Ctrl+Shift+Enter.

EDIT:

As pointed out in the comments, you want to match the current month, so incorporating @JMax’s suggestion works:

=INDEX(B1:B4,MATCH(MONTH(TODAY()),VALUE(MID(A1:A4,4,2)),0))

To clear up any confusion, MID() returns a string, which by itself will not return a match for the number value returned by MONTH(TODAY()). However, if you stick the MID() function inside a VALUE() function, the string returned by MID() will be converted into a number value. E.g., “09” becomes the number 9, “10” becomes the number 10. This allows you to match the number value returned by MONTH(TODAY()).

However, if your dates are entered as dates with format dd.mm.yy in your sheet instead of as strings, then you can use the same strategy but with a different matching term:

=INDEX(B1:B4,MATCH(MONTH(TODAY()),MONTH(A1:A4),0))

Enter this as an array formula.