Change contents of cell where formatting cells doesn't assist - excel

I have a cell with the data in it in the format of 01/07/2012 6:58:13 AM
However I would like the date only, I have tried to Format Cells and select the format I want 01/07/2012 but the time still remains.
How can i get rid of it?

Assuming that the date for some reasons is stored as text (e.g. you're using a non-English system), you can parse the text and convert it to a proper date with the following function: =DATE(MID(A1,7,4),MID(A1,4,2),LEFT(A1,2))
If you have an English system (it might also work on other locales, just give it a try), you don't have to parse the text, but simply convert it with this formula: =--A1 (and format the cell as Date).

Related

How do I make Excel read my not completely filled in dates correctly in my regional format? (dd.mm)

I have used a previous version of Excel and OpenOffice Calc, and I was able to format dates to the Ukrainian format "dd.mm.yy" so that when I typed for example "1.8" in the cell marked with this format, it correctly read it as "01.08.22" (the first of August of the current year). Now I'm using the newest Excel and for some reason when I type in "26.08", it autocompletes as "26.01.00" with the following in the formula section: "1/26/1900 12:14:24 AM". Now I could understand not filling in the year I want it to, but not even the month?
And when I do fill it in fully, I don't think it recognizes the text as a date at all! The dates filled in previously in the same document are interpreted and formatted correctly, but not the new ones. The format is identical, I formatted the whole range of cells together.
Typing "8/26" gives me the desired date, but it's not my regional format and it's inconvenient to use.
Is there a way to make Excel do what I want, here?

Date-text is not converting to real date

I had a bad time trying to import some excel data, then I found that there's a problem with a date field.
I thought the field is string-date text, but when I try to convert it to real-date, not all data convert well Here's a sample below
I tried to format cells, didn't work. Then tried
1- DATEVALUE and VALUE functions
2- ADD zero
3- DELIMITED text to columns
but nothing appears to work. What is this type of data?? and how to convert to real text?
appreciate your help.
In B2 enter:
=IFERROR(VALUE(A2),DATE(RIGHT(A2,4),MID(A2,4,2),RIGHT(A2,2)))
EDIT#1:
Fixed Formula and format:
=IFERROR(VALUE(A2),DATE(RIGHT(A2,4),MID(A2,4,2),LEFT(A2,2)))
If one has textjoin:
=--TEXTJOIN("/",,FILTERXML("<a><b>"&SUBSTITUTE(TEXT(A1,"mm/dd/yyyy"),"/","</b><b>")&"</b></a>","//b["&{2,1,3}&"]"))
If not then parse the TEXT:
=DATE(RIGHT(TEXT(A1,"mm/dd/yyyy"),4),MID(TEXT(A1,"mm/dd/yyyy"),4,2),LEFT(TEXT(A1,"mm/dd/yyyy"),2))
Solved it!!
I needed to change my machine date format, I am not certain but here's what I think was the problem.Because the data was a string-date not a real date, so excel took format of my machine which was mm/dd/yyyy. so for the first date 20/01/2000, excel cannot put 20 as a month when I try to change format or run (text to column) or result in error in DATEVLUE and VALUE, so lots of dates didn't get formatted or resulted in error. On the other hand, the second date, 07/02/2002, can be formatted and functions work well.
So, changing my machine format to dd/mm/yyyy solved the issue and data converted with simple Text to Column.
Big Credit for #ScottCraner

How to create a consistent range of dates in excel?

I have a combination of two reports into a master file. I'll be eventually transforming the data into a more readable format, but I have a date column that has two different types of date formats:
(yyyy-mm-dd & mm/dd/yyyy)
Is there a formula I can use to convert this so every cell reads: mm/dd/yyyy?
I know I can do it via text-to-columns, but that will take a bit longer than I'd like.
I will repost the question if it only can be done via VBA, but I figure there may be a way to just complete it via one formula and an auto fill.
You can probably just use:
=DATEVALUE(A1)
And copy it down. You can then format the date to whatever format you like.
DateValue() Takes a date stored as a string and converts to excel's date type.

How to change general date format in excel?

Quick but not a simple question for me: How to change the date format in excel so it not only affects how I see the date but also how Excel understands this format?
I mean, I want to have date like 04/13/2018 in cells and I changed to this format (it works fine) but excel still converts it to "13.04.2018" in the text field above the sheet. And It cannot be like that because I have macros built in those cells that keeps throwing errors that date format is still wrong and it needs "MM/DD/YYYY"...
Maybe I can somewhat change my region/locale formats in excel?
Alex
The result that came out shows that Excel understands that format. If you want to make sure that Excel understands your style of format, then you probably would want to change the DATE and DATE_TEXT function.

Some dates recognized as dates, some dates not recognized. Why?

Here is a list of dates:
04-22-11
12-19-11
11-04-11
12-08-11
09-27-11
09-27-11
04-01-11
When you copy this list in Excel, some of them are recognized as dates, others not, in the following manner:
04-22-11
12-19-11
11-04-11 (date)
12-08-11 (date)
09-27-11
09-27-11
04-01-11 (date)
Does anyone know why? And how to force Excel to recognize all list items as dates?
Many thanks!
It is caused by Excel auto-recognizing/formatting the cell contents, but in unclear/inconsistent ways.
Fixing it is not that hard...
Check out this forum post:
http://www.pcreview.co.uk/forums/excel-not-recognizing-dates-dates-t3139469.html
The steps in short:
Select only the column of "dates"
Click Data > Text to Columns
Click Next
Click Next
In step 3 of the wizard, check "Date" under Col data format, then
choose: "DMY" from the droplist.
Click Finish
This is caused by the regional settings of your computer.
When you paste data into excel it is only a bunch of strings (not dates).
Excel has some logic in it to recognize your current data formats as well as a few similar date formats or obvious date formats where it can assume it is a date. When it is able to match your pasted in data to a valid date then it will format it as a date in the cell it is in.
Your specific example is due to your list of dates is formatted as "m/d/yy" which is US format. it pastes correctly in my excel because I have my regional setting set to "US English" (even though I'm Canadian :) )
If you system is set to Canadian English/French format then it will expect "d/m/yy" format and not recognize any date where the month is > 13.
The best way to import data, that contains dates, into excel is to copy it in this format.
2011-04-22
2011-12-19
2011-11-04
2011-12-08
2011-09-27
2011-09-27
2011-04-01
Which is "yyyy-MM-dd", this format is recognized the same way on every computer I have ever seen (is often refered to as ODBC format or Standard format) where the units are always from greatest to least weight ("yyyy-MM-dd HH:mm:ss.fff") another side effect is it will sort correctly as a string.
To avoid swaping your regional settings back and forth you may consider writting a macro in excel to paste the data in. a simple popup format and some basic logic to reformat the dates would not be too difficult.
In your case it is probably taking them in DD-MM-YY format, not MM-DD-YY.
The quickest and easiest way to fix this is to do a find and replace on your date seperator, with the same separator.
For example in this case Find "-" and Replace with "-", not sure why this works but you will find all dates are right-aligned as they should be after doing this.
Here is what worked for me. I highlighted the column with all my dates. Under the Data tab, I selected 'text to columns' and selected the 'Delimited' box, I hit next and finish. Although it didn't seem like anything changed, Excel now read the column as dates and I was able to sort by dates.
The simplest solution is to put yy,mm,dd into the date() formula by first extracting them with left(), mid() and right(). In this case, assuming your input date is in A1:
=date(right(A1,2)+100,left(A1,2),mid(A1,4,2))
Explanation of above:
=right(A1,2) gets the last two digits in the cell (yy). We add 100 because it defaults to 1911 instead 2011 (omit +100 if it doesn't do that on yours)
=left(A1,2) gets the first two digits in the cell (mm).
=mid(A1,4,2) gets 2 digits in the middle of the cell, starting at 4th digit (dd).
Why this happens in the first place:
I come across this problem all the time when I import Canadian bank data into excel. In short, your input date format does not match your regional settings.
Seems your setting mean Excel wants date input as either DD-MM-YY or YY-MM-DD, but your input data is formatted as MM-DD-YY.
So, excel sees your days as months and vice-versa, which means any date with day below 12 will be recognized as a date, BUT THE WRONG DATE (month and day reversed) and any date with day above 12 won't be recognized as a date at all, because Excel sees the day as a 13th+ month.
Unfortunately, you can't just change the formatting, because Excel has already locked those day/month assignments in place, and you just end up moving what Excel THINKS are days and months around visually, not reassigning them.
Frankly, it is surprising to me there is not a date-reverse tool in excel, because I would think this happens all the time. But the formula above does it pretty simply.
NOTE: if your dates don't have leading zeros (i.e. 4/8/11 vs 04/08/12) it gets trickier because you have to extract different amounts of digits depending on the date (i.e. 4/9/11 vs 4/10/11). You then have to build a couple if statements in your formula. Gross.
Here is what worked for me on a mm/dd/yyyy format:
=DATE(VALUE(RIGHT(A1,4)),VALUE(LEFT(A1,2)),VALUE(MID(A1,4,2)))
Convert the cell with the formula to date format and drag the formula down.
Right-click on the column header and select Format Cells, the chose Date and select the desired date format. Those that are not recognized are ambiguous, and as such not interpreted as anything but that is resolved after applying formatting to the column. Note that for me, in Excel 2002 SP3, the dates given above are automatically and correctly interpreted as dates when pasting.
A workaround for this problem consists in temporarily changing your regional settings, so the date format of the CSV imported file "matches" the regional settings one.
Open Office seems to work in a similar way for that issue, see: http://www.oooforum.org/forum/viewtopic.phtml?t=85898
I come across this problem when I tried to convert to Australian date format in excel. I split the cell with delimiter and used the following code from split cells then altered the issue areas.
=date(dd,mm,yy)

Resources