Converting month number from full date cell into text month in Excel - excel

So I have a pretty long column with name dates and hours, like this:
14/01/2017 03:30
(They are DD/MM/YYYY HH:MM)
I need to get the month number and show it as text, like January, February, and so on.
If I format the destination cell as 'MMM' all the column cells show January even if the given month is 2, 3, or let's say 12. I also tried the formula =TEXT(L2,"mmmm") (since the given info come from column F.
Any ideas?

sounds like your date and time are stored as text and not in excels serial date format. You can test this by changing the format of the cell to general and seeing if anything happens if nothing changes then its text. another way would be to use the formula =istext(A1) where A1 is a cell with a date in it.
Now ASSUMING you do have dates in text format, I would suggest converting them to excels date serial. There are numerous ways of doing this. I will show you one way.
This will strip each component of the text out and then recombine it. We will assume your date in is A1
Strip out the year
=MID(A1,7,4)
Strip out the month
=MID(A1,4,2)
Strip out the day
=LEFT(A1,2)
Now to recombine it:
=DATE(MID(A1,7,4),MID(A1,4,2),LEFT(A1,2))
That will give you the date in an integer format that excel can then turn around and display as needed.
In order not to lose the time component you should strip that part off as well and combine it with the date. Remember the date is an integer, and the time is everything after the decimal. Think of time as a fraction of a day.
To get time out use:
=RIGHT(A1,5)
and to convert it to excel time:
=TIMEVALUE(RIGHT(A1,5))
and to get the two together, simply add:
=DATE(MID(A1,7,4),MID(A1,4,2),LEFT(A1,2)+TIMEVALUE(RIGHT(A1,5))
The key part to this whole thing is you will need to format that cell to display what you want. you can either choose a preformatted style from the drop down menu, or you can apply custom formatting. Setting the custom format to MMMM should display just the full name of the month.
IF you actually need the text of the month and not just the format, then you could use the formula from your question:
=TEXT(<insert appropriate formula from above>,"mmmm")

Try using MID to get the month only, then TEXT():
=TEXT(MID(A1,SEARCH("/",A1)+1,2),"MMMM")

Related

Match function with dates

I have date column on two different sheets and when I run a match function (part of index match) it comes up N/A, because Excel says the two cells that have the same date in them are not equal to each other. When I change the format of one of the columns it changes to five numbers (which I know that is what excel uses to track dates), but the other column does not do this, it is simply text.
My question is, how to I get excel to forget about the five number date format and just give me text? Paste special values doesn't get it done like I thought it would.
I would say that you basically have two options: either convert both to text, or convert both to dates. If you want the text, the easiest way to convert them to text is via text to columns:
Select the column with the date (the one that turns to a 5 digit number when formatted to number or general) and select Text to Columns:
Click on next twice and select Text, then finish:
And that should do it.
I'll mention the other method, just in case, because in my experience, it's more often more practical to get the dates as actual dates in excel rather than text, especially when one wants to perform calculation on them or allow for different date formats.
The other method involves inserting 1 somewhere and copying it. Then select the set of dates that is plain text:
Use the paste special function and select 'Multiply' under the operations section:
All the dates normally should turn into those 5 digit numbers (if they were originally formatted as general for example). You simply then need to format them as date with the appropriate format, and your index/match should be fine matching the two date columns.
Excel will struggle to compare text (date as text) with numbers (date as an integer).
My suggestion is to convert the text into a 'proper' date. This is a good habit. When excel recognises something as a date it will store it as that 5-digit integer, but can display it however you choose (format cells to see the options)
So create a column next to your 'text dates'. Fill it with a formula which will create a 'proper' date, using the existing text.
If your text is in A1, then put this in B1. Assuming your data is dd/mm/yyyy
=date(right(a1,4),mid(a1,4,2),left(a1,2))
This is just saying that:
Year = rightmost 4 characters
Month= middle 2 digits (start at character 4 and grab 2 digits)
Day = leftmost 2 digits.
I assume you are using normal dates, and not the abomination that is USA format dates. But if your text is in USA data format then just swap the month and day parameters. Likewise if your text dates are 2 digits just tweak the 'year' parameter.
Check it works as expected, then copy down the column. You can now use column B for your vlookup or index match.
nb Jerry's answer is excellent and should work. I added the above because it tells you a little about how to directly work with dates. Good luck.

Formula to convert a cell formatted in MM/DD/YYYY , to numeric month.

Is it possible to convert the standard excel format (MM/DD/YYYY) to just the month? I have column B that has a date format &column V where I have the month. I have check the internet/stack overflow, but have only found conversions for changing the format of the date.
you mean like the MONTH() formula?:
=MONTH(B1)
If the date is stored as an excel serial, to display just the month without losing the potential other information such as year, day, and time that might be stored with it, you are usually better off reformatting the display of the cell.
If you set the format of the cells to General and the numbers change you know you have your date in an Excel format. If they do not change you have them as a string.
Select custom format for the cell format and go to the area when your can type in display formats and set it either to
m or mm - for numbers to be displayed. The later will give you a proceeding 0 for single digit months.
mmm - for the first three letters of the month.
mmmm - for the full spelling of the month.
If you need to make comparisons of the month from a full date, use the formula macro man listed in a manner like:
=Month(B1)=Month(V1)
That will display true if the months for the dates in both A1 and V1 are the same.

Excel - Convert Date & Time to Date Format

I am working with a column of data which contains a date/time stamp of an event. The printed form is in US format, as follows:
12/25/2014 11:00 AM
The cells are formatted as "General". I'm looking to convert the column into a Date / Time field for ease of filtering and searching. Thus far the only way I've been able to convert the text is to use "Text to Columns" and import the columns delimited by a Space, but this hasn't gotten me exactly what I want as it imports the date perfect, but the time is still text and in another column, which isn't pretty.
Is there an easier way? Thanks in advance
Since these values are apparently text strings, you won't be able to change the values by formatting. Excel stores dates (and times) as days and fractions of a day since 1/1/1900. You have, I believe, four non-VBA options:
Change the data before you enter into your worksheet, to be in the same format as your Windows Regional Settings short date (perhaps DMY?)
Change your Windows Regional Settings short date format to match that of the data you are importing.
Split the data using Text to Columns as you have been, then combine the two fields with an addition. e.g.
Original data in A1
Split data in A1:B1
Combine -- C1: =A1+B1
Copy C1; PasteValues (C1), then delete A1:B1
Use a formula to separate the different segments. The following assumes your Windows Regional settings AM/PM designation is, indeed, AM/PM, otherwise the formula would have to also account for that. Also, if the format is mm/dd/yyyy hh:mm AM/PM then the formula could be simplified. The formula below assumes the format is m/d/yyyy h:mm AM/PM and that AM/PM works in your locale.
=DATE(
MID(A1,FIND("/",A1,4)+1,4),
LEFT(A1,FIND("/",A1)-1),
MID(A1,FIND("/",A1)+1,FIND("/",A1,4)-FIND("/",A1)-1)
)
+TRIM(MID(A1,FIND(":",A1)-2,9))
You should try custom formatting of date and time.
If working with Google spreadsheet see this link.
If working with excel see this link.

Different date formats in Excel

I have a csv that contains a list of dates, once imported into Excel they are in 2 different formats. How can I get them all in the same format?
Example:
01/23/2012
01/26/2012
40910
41031
You probably have a BIG issue with your file!
Probably, Excel is recognizing dates as "dd/mm/yyyy" but your data is "mm/dd/yyyy" formatted.
So, your numbers are really dates (just format, as #t.thielemans suggested). But are incorrectly parsed - month and day are switched!
Solution (assuming your dates are on A:A column):
To convert text to date:
=DATE(RIGHT(A1;4);LEFT(A1;2);MID(A1;4;2))
To correct day/month:
=DATE(YEAR(A1);DAY(A1);MONTH(A1))
Detect whether cell has date (dates are numbers, in Excel) or text:
=ISNUMBER(A1)
Finally, all combined within one formula:
=IF(ISNUMBER(A1);DATE(YEAR(A1);DAY(A1);MONTH(A1));DATE(RIGHT(A1;4);LEFT(A1;2);MID(A1;4;2)))
Just drag last formula from first row to end of your data and then format it as you wish (see #t.thielemans solution).
Select your data column and make sure they're highlighted. Go to Home>Number and select Custom and enter mm/dd/yyyy. You can also change the layout to one you want (mm-dd-yyyy/mmddyyyy/dd-mm-yyyy/...)

How to subtract dates in Excel with different date formats?

I want to subtract 2 dates in Excel but the problem is they have different date formats.
So... my first date is something like this 18.09.2011 (DD.MM.YYYY) and the second one is something like 9/15/2011 (MM/DD/YYYY). So how can I subtract these two dates? Because DAY(cell of date one) - DAY (cell of date 2) won't work.
Thanks!
If your dates are really entered as dates you can use them in any kind of calculation, as a date really is stored as a numeric value. Displaying one date in "MM/DD/YY" and the other one in "DD.MM.YYYY" doesn't make a difference. Try to format the cells as "General". Does the display change to a number (e.g. 40801 for today) you're fine. If your dates are entered as strings you may want to convert them into dates first - see this post

Resources