Tuesday, September 6, 2016

Extract/ Get Month name from date in excel

Month from a Date

If only want a month to appear from a date, No need for any formula,
Just press CTRL + 1 and under custom settings change the format to :
"mmm"  // "Jan"
"mmmm" // "January"

Excel will display only the month name, but it will leave the date value intact.

However, if you want to remove the date and only show the month:
then use formula : =text(b4,"mmm")

A more flexible way

If you want maximum flexibility, you can "map" the month to a month name directly in the CHOOSE function like so:
=CHOOSE(MONTH(B4),"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")
Enter the month names you want to return (abbreviated or not) as values in CHOOSE, after the first argument, which is entered as MONTH(date). MONTH will extract a month number, and CHOOSE will use this number to return the nth value in the list. This works because MONTH returns a number 1-12 that corresponds to the month name.
CHOOSE is more work to set up, but it is also more flexible, since it allows you to map a date toany values you want (i.e. you can use values that are custom, abbreviated, not abbreviated, in a different language, etc.)