Extract value based on actual month & year

bigellow

New Member
Joined
Nov 24, 2011
Messages
14
Office Version
  1. 2021
Platform
  1. Windows
Hi all,

I have the following table with dates in A column, formatted as date, and values on B.

I would like the Cell C2 to show only the value that correspond to actual month and year, the date doesn't matter. For this month, it should show 10, for the next month ( from 1st of April) it should be shown 20 and next year in January to show 50 )

I tried following formula's, but it doesn't work

=VLOOKUP(AND(YEAR(TODAY());(MONTH(TODAY())));A2:B6;2;FALSE)

=VLOOKUP(MONTH(TODAY())&"/"&(YEAR(TODAY()));A2:B6;2;TRUE)

Thanks for the advice!

Value for the current month and year
31/03/2024​
10​
10​
30/04/2024​
20​
31/05/2024​
30​
30/06/2024​
40​
31/01/2025​
50​
 
Last edited:

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Hi

Excel Formula:
=XLOOKUP(TEXT(TODAY(),"YYYYMM"),TEXT(A2:A6,"YYYYMM"),B2:B6)
 
Upvote 0
What version of Excel are you using?

I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)
 
Upvote 0
What version of Excel are you using?

I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)
Thanks for the tip, done.
 
Upvote 0

Forum statistics

Threads
1,224,771
Messages
6,180,860
Members
453,003
Latest member
SalihZekiKoni

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