Excel weird behaviour with dates => text - excel

I have a ton of cells that contain dates such as 22/12/2013. This is set automatically as Date format. And if I try to change the cell format to text (Simply because I want it to be text rather than a date so that I can read it later with PHP), the thing changes completely.
Here's how to replicate the error.
Write in a cell 22/10/2013
Change the format to TEXT
The original content gets changed to 41569
I need a way to fix this, because otherwise when I read the date with PHP, it gets convereted to 41569 nonetheless. But if I manage to make it text, it will be alright.

As andy holaday says, using cell formatting to change the format won't actually change existing numbers (dates) to text. You can do that with "text to columns" functionality:
Select column of dates > Data > Text to columns > Next > Next > at step 3, under "column data format" choose "text" > Finish
That converts existing dates, if you have dates to enter which you want to enter as text you can add an apostrophe, as Polly says, or you can simply pre-format the entry column as text format.

It's not an error. Changing the format of a cell does not change the value that is stored in that cell. Excel stores dates as numerical values. What I think you want to do is change the numerical value into text that resembles a date. Try this formula in a new cell somewhere:
= TEXT(A1,"dd/mm/yyyy")

Enter your dates with an apostrophe at the beginning. '22/10/2013 will be interpreted as a text string.

Related

change cell format to general or text?

we have sort of data in excel like this ---> 34:5:20
excel likes to consider it as time or date.
here is the problem because I know it's not a date and what ever action I want to do with it again
excel thinks it's a date/time value .
how can I stop this behavior ?
(each of the ':' delimited values has a special meaning to me but not date/time)
thanks a lot.
There is one option though, you can use the formula below, to convert the dates back to your format
=CONCAT(" ",TEXT(A2,"[h]:mm:ss"))
I am adding a space using concat function just so that if you ever decide to convert all to value, it will not return back to dates
I found the solution finally .
copy column to notepad.
select another column
change it's format cell to text.
now paste from notepad.
now my data is considered as text and I can separate the values using "column to text" from DATA tab.
thank you all for your valuable time.

How to make excel stop treating column as date

My column values are as follows:
1-1
1-2
2-1
2-2
...
12-1
12-2
13-1
13-2
...
n-1
n-2
On cells containing 1-1 up to 12-2, excel doesn't meddle with me, but starting on 13-1 up to the nth row, it shows warning "Text date with 2-digit year". Unfortunately, this are really not dates. Also, I already tried formatting the said rows/cells as text before inputting any values, but really when excel sees "13-1" and above, it shows the error. How should I fix this?
Additional info: when the rows are shown using formula, there are no errors, but sadly, using formula is not an option and I need values as is.
You can type ="1-1" instead of just 1-1
When you type 1-1, excel change this to 1-Jan. When you type ="1-1" , Excel treat the value as string. Hope it helps.
Just right click on the column click on Format Cells ... on Number Tab on Category List select Text, this will make anything you enter or have as a text.
But if you are copy paste data then use Match Destination Format (M), just right click on the cell and select Match Destination Format (M) not Ctrl-V.
If you add a single quote to the start of the dates Excel treats it as a string. Works for numbers as text too
Stop excel from converting copy-pasted number/text values to date
Copy the original data
Paste to Notepad / Notepad++
In Excel, change the Format Cells / Number Format (that shows "General" as default) to TEXT
Copy your data from Notepad
Paste back to the Excel cells, in which you have changed the format to TEXT
Turn off error checks for those types of errors.
With Application.ErrorCheckingOptions
.TextDate = False
.NumberAsText = False
End With
Also found within File, Options, Formulas, Error checking rules.

Change date format of cell in excel from dd.mm.yyyy to yyy/mm/dd ( excel version 2013 )

I have been searching it for an hour but unfortunately nothing found that actually work. I have an excel sheet with a column having date in it. Current date format is dd.mm.yyyy but I want to change date format to yyyy/mm/dd for entire cell.
OPTION 1)
Assuming that you source date that is in the number format dd.mm.yyyy stored as an excel date serial and only formatted to display as dd.mm.yyyy then the best fix is to select the cells you want to modify. Go to your home tab, and select the number format and change it to General. See Green circles in image below. IF the format is already set to general, or when you switch it to general your numbers do not change, then it is most likely that your date in dd.mm.yyyy format is actually text. and will needed to be converted as per OPTION 2 below. However, if the number does change when you set it to general, select the arrow in the bottom right corner of the number area (see red circle).
After clicking the arrow in the red circle you should see a screen similar to the one below:
Select Custom from the category list on the left, and then in the Type bar enter the format you want which is yyyy/mm/dd.
OPTION 2
=date(Right(A1,4),mid(A1,4,2),left(A1,2))
This assumes your original date is a string stored in A1, and converts the string to a date serial in the form excel stores dates in.1 You can copy this formula down beside you dates. You can then apply cell formatting for the date as described above, or use the build short or long date if that style matches your needs.
1Excel counts the number of days since January 0 1900 for the windows version of excel. I believe mac is 1904 or 1905.
The problem is that your date is a text string, so changing the cell number format won't have any effect.
One method of convert the dates in place to "real" dates is to use the Text to Columns wizard.
Select your date(s).
Select the Text to Columns option on the Data Tools Tab of the Data Ribbon:
At Step 1, select "Fixed Width" then "Next"
Step 2 is irrelevant
At Step 3, for the date column, select DMY as the format. You can also select the "Destination" if you want the results written elsewhere.
Then "Finish".
That's it. Your dates will be converted in place
Since your dates are now "real" Excel dates, you can use the Cell ► Number Format dialog to change the format to whatever you want.
Nothing wrong with your format i.e. yyyy/mm/dd. You can use:
=TEXT(A1,"yyyy/mm/dd")
Update
A comment was made on this question re the TEXT function converting a date-serial to text. It will still be possible to apply date functions to the output of the TEXT function and get an output. E.g. here we can see WEEKDAY returning a result on the value of B1 (which in turn is formatting A1):
You are making this way too complicated. Just use the DATE(year,month,day) function and switch the DAY() and YEAR() inside it.
If in cell A1 you have a European-style date in this format: 12-04-2017; Excel will interpret this as Dec 4, 2017.
Excel will interpret it properly as Apr 12, 2017 if you change it to the American-style of 04-22-2017 by writing this equation in another cell: "=DATE(YEAR(A1),DAY(A1),MONTH(A1))".
(I put the DAY() in the month spot and the MONTH() in the day spot.)
Now you can use any date format you want.
I use 'substitute' to replace the '.' with a '/'.
Then use the date format to get the correct format.

Within excel 2010 how can I convert text formatted number ###### into time formatted as mm:ss.00

I have found other similiar topics on the forum but I am struggling to find a way in excel 2010 to convert text formatted numbers ###### into time formatted as mm:ss.00
Any assistance offered would be really appreciated and it would save me lots of data entry time and data entry errors.
thanks
Nigel
The ###### could simply mean your column widths are too small. Try expanding them and see if that works. Otherwise, you can modify the format (cell data type) by simply right clicking it and selecting "Format cells...". From there, you can select the "Time" format or create your own in the "Custom" format, both located under category.
If you always want the milliseconds to be "00", you may want the custom format mm:ss:"00"
Try this:
Where your text column begins in A1, and result column begins in B1
Custom formatting for column B, mm:ss.00;#
=TIME(,LEFT(A1,LEN(A1)-4),MID(A1,LEN(A1)-3,2))+TIME(,,RIGHT(A1,2))/100

Change contents of cell where formatting cells doesn't assist

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).

Resources