How to extract month name from custom date - excel

I have a CSV file which has date in mm/dd/yyyy format in column A. Here are the steps that i took to extract month from it.
Select the entire column A and click on Format Cells
In Format Cells, Click on Custom and used the string mm/dd/yyyy there
Clicked Ok
On column D (or any other column), I entered the following text =TEXT(A1, "mmmm"). This text is supposed to extract month number from column A1 and convert into month. But it just copies the whole date there.
What i am missing here?

The dates that you see are most likely strings that look like dates. You can convert them to actual dates using the DATE(year, month, day) function. Something like:
=DATE(RIGHT(A1,4), LEFT(A1,2), MID(A1,4,2))
(A1 contains the text date.) And then you can apply the date format to the column where you put this formula.

The text you specified is the syntax for getting the month name as a formula.
If you are just changing the number formatting of the cells, you specify the custom number format mmmm.

Point two should be changed. In the Format Cells click on Date and select anything from the predefined formats:
Then the initial formula should work:
=TEXT(A1, "mmmm")

Related

how to change format of date from mm/dd/yyyy to dd/mm/yyyy in MS Excel

The format is not changing from mm/dd/year (e.g 08/28/18) to dd-mm-year (e.g 28-08-2018)
it is not updating, just staying the same.
please assist.
Your date is not currently being stored as a date value and is most likely text. You can test this out in several ways:
Select the cell and change the format to general. If is now shows a number then the date stored in the cell is numeric in value and we be subject to date change formats. If it remains as is then is is text.
Assuming the date is in cell A1, ISTEXT(A1). A TRUE result means its text.
Assuming the date is in cell A1, ISNUMBER(A1). A FALSE result means its text.
You can use the DATEVALUE function to convert TEXT dates to excel date values. however you need to be very aware of the date value you are starting with. This also is conditional with your system date settings.
A more generic and guaranteed method is to strip out the text for day, month, year, and toss them into the DATE function. Your life will be a bit easier since you have leading 0s. Assuming a date in cell B2 your formula could look like the following:
Day:
MID(B2,4,2)
Month:
LEFT(B2,2)
Year:
RIGHT(B2,2)
Now that you have striped out all the specific text as needed, drop the appropriate formula into the DATE function
DATE(YEAR,MONTH,DAY)
DATE(RIGHT(B2,2),LEFT(B2,2),MID(B2,4,2))
Apply custom formatting to the cell where the is located:
dd-mm-yyyy

How to check date format in Excel

I have around 20,000 records in an Excel file and around four columns which have dates. I am trying to insert those into SQL. However date columns have dates in incorrect format eg; 02/092015 or 02/90/2015 or 2015. So checking 20,000 records one by one would be very lengthy.
I tried to count / but it didn't work. It changes the format of column to date.
I was looking for some formula which can check the format and maybe color the cell or something like it.
I was running across this issue today, and would like to add on to what nekomatic started.
Before we begin, the TEXT formula needs to follow the date format we are working with. If your dates are in month/day/year format, then your second argument for the TEXT formula would be "mm/dd/yyyy". If it is in the format day/month/year, then the formula would need to use "dd/mm/yyyy". For the purposes of my answer here, I am going to have my dates in month/day/year format.
Now, let's assume that cell A1 contains the value 12/1/2015, cell A2 contains the value monkey, and cell A3 contains the value 2015. Further, let's assume our minimum acceptable date is December 1st, 2000.
In column B, we will enter the formula
=IF(ISERROR(DATEVALUE(TEXT(A1,"mm/dd/yyyy"))),"not a date",IF(A1 >=DATEVALUE(TEXT("01/01/2000","mm/dd/yyyy")),A1,"not a valid date"))
The above formula will validate correct dates, test against non-date values, incomplete dates, and date values outside of an acceptable minimal value.
Our results in column B should then show 12/1/2015, not a date, and not a valid date.
Two of the examples you give are text which may be identified with Conditional Formatting by applying a formula rule such as:
=ISTEXT(A1)
and colouring the result as you wish. There would be an issue if all your dates (even those of valid format) are also text but I'm guessing that is not the case.
For the third example (ie 2015) a CF formula rule such as:
=AND(A1<2500,A1>0)
may help.
If your columns are a mixture of what should be dates and other entries that are properly text strings your approach may be better than the more general ISTEXT, for example a CF formula rule of:
=FIND("/",A1)>0
If you can add a column to the Excel sheet with the formula
=DATEVALUE(TEXT(A1,"dd/mm/yyyy"))
this should return #VALUE if the contents of A1 are not a valid date in dd/mm/yyyy format. You can filter on this value to identify the incorrect records.
Edit: If A1 contains only 2015 this formula returns 07/07/1905 (if the formula cell is formatted as date) so you can spot these by filtering for dates before the earliest correct date your file should contain.

How do I get a year (yyyy) from a mm/dd/yyyy in Excel?

I have a column formatted as mm/dd/yy and I need to build a column that gives me yyyy.
Thanks!
Searched a little differently and found the answer.
Use the YEAR function, with the variable being the cell that currently has the mm/dd/yy date.
If A1 contains the full date, then in another cell use:
=Year(A1)
If your date is in A1, and you know the format will always be correct, with a 4 digit year on the far right:
=RIGHT(A1, 4)
You can also create a custom date format that only shows the year. Highlight your column, click the drop down for number formats and select Custom.
Enter a custom format here and click OK. For your case, use "yyyy".

How to represent date and time in one excel cell?

How to represent date and time in one excel cell?
There are cell formats such as date and time. But there
is no one format that includes both date and time.
How should I write both date and time in one cell then?
What I had to do is to split the date and time in two
separate cells like this:
Edit: This picture shows how I get a date and the incorrect result I get.
If you enter:
=NOW()
in a cell and format the cell as Custom
dd/mm/yyyy hh:mm:ss
You should get what you want.

In excel: How to determine if 01/01/1900 then print out empty string, otherwise show the date

I'm trying to show all dates except for 01/01/1900. In excel, how do I first check for 01/01/1900 and then replace only that date with empty string or "", but leave any other dates alone? I also need to keep the format set to small date format of mm/dd/yyyy.
I tried to use replace, if, date, datevalue commands without successs.
Another answer which does not affect your data, but only the presentation layer is to set up a custom formatting. Choose the cells you want, and press CTRL+1 or choose Format Cells from the Format menu. Then under number format, Date should be selected. Click on Custom at the bottom of the list, then add two semicolons after the formatting string picture that is there.
A custom formatting string can have three (sometimes four) pictures seperated by semicolons. The first is for positive numbers, the second for negative, and the third for zero.
My formatting string looks like this: 'm/d/yyyy;;'. All zero dates (1/0/1900) will be blank. No extra column needed.
Create a new column next to your column with dates, and use this formula for every cell (A1 here refers to the source cell):
=IF(A1<>DATE(1900,1,1),A1,"")
Then format your new column as a date.

Resources