Convert date to month name

ANE0709

Board Regular
Joined
Feb 2, 2022
Messages
65
Office Version
  1. 365
Platform
  1. Windows
i have a date range in J that shows "1/9/2022 - 1/15/2022" which i need to convert to show the name of the month for the first date only. I was using =text(left(J2,10),"mmmm") before my file was corrupted. now im starting over and putting all formulas in from scratch. this one was working but isnt anymore. Any ideas why not and how to fix it?

1644265635242.png
 
Why? The TEXT function is not bothered by the trailing space. Given that, and on the off chance that occasionally there might not be a space between the date and dash, this might be slightly better...
Excel Formula:
=TEXT(LEFT(J2,FIND("-",J2))-1,"mmmm")
OCD? I don't know.

Besides, if there might not be a space, the original specs are violated and all previous responses are wrong, with or without the extra space.
 
Upvote 0

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Besides, if there might not be a space, the original specs are violated and all previous responses are wrong, with or without the extra space.
Okay, you are probably right about that, but here is another way to do what the OP wants which does not care about the text past the first two characters...
Excel Formula:
=TEXT(28*SUBSTITUTE(LEFT(A1,2),"/",""),"mmmm")
Yeah, I know... no one is going to use this formula... I just posted it for its interest value.
 
Upvote 0
Besides, if there might not be a space, the original specs are violated and all previous responses are wrong, with or without the extra space.

Hi,

If there is no space, @Rick Rothstein formula in Post # 10 would still work.

Why? The TEXT function is not bothered by the trailing space. Given that, and on the off chance that occasionally there might not be a space between the date and dash, this might be slightly better...
Excel Formula:
=TEXT(LEFT(J2,FIND("-",J2))-1,"mmmm")

Although I think Rick had a typo and actually mean this:

Excel Formula:
=TEXT(LEFT(J2,FIND("-",J2)-1),"mmmm")

Now, what if there was No Space, and No Hyphen (or even no slashes "/") at all?
I think we can only work with what OP supplied as sample data, yes?

Book3.xlsx
JKLMNO
1Post # 3Post # 9Post # 10Post # 10 correctedPost # 12
21/9/2022 - 1/15/2022JanuaryJanuary#VALUE!JanuaryJanuary
31/9/2022-1/15/2022#VALUE!#VALUE!#VALUE!JanuaryJanuary
41/9/20221/15/2023#VALUE!#VALUE!#VALUE!#VALUE!January
Sheet990
Cell Formulas
RangeFormula
K2:K4K2=TEXT(LEFT(J2,FIND(" ",J2)),"mmmm")
L2:L4L2=TEXT(LEFT(J2,FIND(" ",J2))-1,"mmmm")
M2:M4M2=TEXT(LEFT(J2,FIND("-",J2))-1,"mmmm")
N2:N4N2=TEXT(LEFT(J2,FIND("-",J2)-1),"mmmm")
O2:O4O2=TEXT(28*SUBSTITUTE(LEFT(J2,2),"/",""),"mmmm")
 
Upvote 0
Although I think Rick had a typo and actually mean this:

Excel Formula:
=TEXT(LEFT(J2,FIND("-",J2)-1),"mmmm")

Now, what if there was No Space, and No Hyphen (or even no slashes "/") at all?
I think we can only work with what OP supplied as sample data, yes?
I sure did have a typo!!! Thanks for catching it.
 
Upvote 0

Forum statistics

Threads
1,215,036
Messages
6,122,794
Members
449,095
Latest member
m_smith_solihull

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