In a excel sheet range A1:A12 , I need months like:
Jan 2020 to Dec 2020 for current year.
and Jan 2021 to Dec 2021 for next year. and so on. Automatically.
I google it but did not find any suitable result.
Plz help me and ignore my weak English and grammar.
Thank You.
Let's say you want a real date, using the 1st of each month (you can then format the cells to just show mmm yyyy or whatever other format you like). In your first cell enter:
=DATE(YEAR(TODAY()),ROWS($A$1:$A1),1)
and copy it down. If you actually want the month as text, just wrap that in the TEXT function:
=TEXT(DATE(YEAR(TODAY()),ROWS($A$1:$A1),1),"mmm yyyy")
Note that the DATE
function will happily adjust the year if you pass a month number greater than 12.
To get This using =TODAY()
function you have to use 2 cells.
Let's use A1 and B1 as the 2 cells. In A1 you will display today's dat as dd/mm/yyyy
=TODAY()
type this in A1
In B1 you will convert it to month and year.
=TEXT(A1,"mmm-yyyy")
type this in B1
But using this method you can only get this month.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.