I have an excel document with about 500 rows.
I need to format all the cells in , let's say, B column from date to text.
This is how it looks like now:
2012-06-15
2012-06-01
2012-06-14
What it looks like when formated to text:
41075
41061
41074
It has come to my understanding that this is a timestamp representing days since 1st januari 1900, right? Anyhow, this is not what I want. I want the value of the field to be exactly what it is but with the column type of text. I've found various solutions for this using functions like this: =TEXT(B1, "yyyy-mm-dd") but that is not reformating the cell, it is extracting a value from one cell, reformat it and represent is as text in another.
The rule I'm after: I want all cells in B column to have the type text without changing the value
Thanks!
If you have a situation where columns A to D are dates of 500 rows you then:
Use the =TEXT(A1, "yyyy-mm-dd") function you describe in cell E1.
Copy this formula 4 columns wide, and 500 rows down.
Then copy and paste values to the preceding cells.
Copy Example:
Output:
You're right, Excel stores dates internally as number of days since January 1st, 1900 (apart from a minor leap year bug).
Thus, I'm afraid you cannot have both:
Either you keep the value e.g. (41075) and simply format it as a date, so it'll be displayed as 2012-06-15 -
Or you convert it to text format - but then you either
Lose the underlying value - if you convert it to the format you wish with a text function as you mentioned
Keep the value (41075), but cannot see the date
If you are typing in the values you can by adding a ' before the values to keep it as text.
e.g.
But depending on the method the third party service uses to import these values this may not work and I bet you will not get around it unless you export it to a text editor and import it again.
Also try to play with diferent types of text for your third party service, e.g. "2012-06-15" as some see the quotes and remove them.
Related
Currently using a calculated SharePoint column (uses same excel formulas)
I have a column "SignIn" that shows the date/time of a staff sign-in. I have another column "Late Flag" that will show if they are late or not. There are sometimes multiple sign-ins/outs throughout the day, So I need the formula to only flag them as late between a certain time frame (09:35:00 AM to 10:15:00 AM). I have tried a few different formulas - but they keep producing unexpected results (like they all show as late, when they're not).
For example:
=IF(AND([SignIn]>"9:35:00 AM",[SignIn]<"10:15:00 AM"]),"Late","")
This shows my column setup
I have a date/time column for SignIn, and a single line of text column for Late Flag
Most likely your data is converted to a timevalue and shows as "9:36:00 AM", but when selected the true cell value will be "09:36:00" which is because excel has recognised it as a time and converted it to one. However in your formula "9:35:00 AM" will be a string (text value) which will never match with a time value. To get around this you can use TIMEVALUE( in your formula to convert it like a time like so:
=IF(AND(A1>TIMEVALUE("9:35:00"),A1<TIMEVALUE("10:15:00 AM")),"Late","Not")
Also, it might be possible the time in your cell is actually text, which cannot be compared to any time value to begin with. This complicates things, but not much, just wrap a TIMEVALUE( around that as well:
=IF(AND(TIMEVALUE(A1)>TIMEVALUE("9:35:00"),TIMEVALUE(A1)<TIMEVALUE("10:15:00 AM")),"Late","Not")
Using the formula below to achieve it.
=IF(AND(TIME(HOUR([SignIn]),MINUTE([SignIn]),SECOND([SignIn])) > TIME(9,35,0),TIME(HOUR([SignIn]),MINUTE([SignIn]),SECOND([SignIn]))<TIME(10,15,0)), "Late", "")
More information: TIME function
I received excel sheet with dates in column U as (Jul 8, 2009).
I changed cells format to custom date (mmm d, yyyy)
now in column V, I added below if statement
=IF(U9="";"No Date";IF(U9>TODAY();"warranty";"expired"))
my problem is: why all values returned as "warranty" what ever date in column U?
May 10, 2016.....warranty
Jul 8, 2011.........warranty
Jan 1, 2017........warranty
Jul 23, 2011........warranty
You need to turn on the automatic calculation:Options>Formulas>Workbook calculation>Automatic
Or you can turn it on in the formulas tab in the tool bar:
It sounds like the data in the sheet might be wrong - have you checked its value and compared this to the value of today? (use the value function on the cell is probably easiest)
There is a '1904' date setting deep in the bowels of the options (under advanced) which some systems use - whereby the dates started at a different point that Excels usual. This means that today would not match today - and the situation you are describing is possible.
The dates you received might have been formatted as Text. In that case changing the cell format won't convert it to date, and some formulas and expressions will regard it as text and not as a date value.
To verify this try to change the date format on one of the date cells that calculate incorrectly to some other date format or number, and you will see there is no effect.
One solution is to add the DATEVALUE() function to your formula:
=IF(U9="";"No Date";IF(DATEVALUE(U9)>TODAY();"warranty";"expired"))
This will work only if all of your dates are formatted as text.
Another solution is to run Text to Columns from the Data menu. This process has the side-effect of converting data types.
Select your dates column and run Text to Columns.
Choose Delimited and click Next.
Remove any selected Delimiters and click Next.
You may choose General or Date and click Finish.
After that your original formula should work correctly.
Addition:
It seems this is not a typical problem and it might have to do with the machine locale settings and date format recognition.
A possible workaround can be using this formula to retrieve the correct date value from a date text formatted as MMM d, yyyy:
=DATE(RIGHT(U9,4),
MATCH(LEFT(U9,3),
{"Jan","Feb","Mar","April","May","jun","Jul","Aug","Sep","Oct","Nov","Dec"}
,0),
NUMBERVALUE(MID(U9,5,2)))
For easy copy:
DATE(RIGHT(U9,4),MATCH(LEFT(U9,3),{"Jan","Feb","Mar","April","May","jun","Jul","Aug","Sep","Oct","Nov","Dec"},0),NUMBERVALUE(MID(U9,5,2)))
Replace the U9 part of your original formula with this formula.
I have been using the following as a formula array beginning in column R2 for an Excel spreadsheet that combines the data from four columns:
=L2&" "&N2&" "&Q2&" "&P2
Column L contains the date in the following format: 2/23/2015.
The formula used to show the date as shown above, but now for some reason the format has changed to go from 2/23/2015 to 42081.
I can't seem to get date to show as it once did. Also the Excel spreadsheet I apply this to is downloaded from a different source each day so I don't know if default formatting has changed even though the data is exactly the same.
When you concatenate like that you just get the values not the formatting because number formatting doesn't apply in the text string created. You can use TEXT function to dictate the format in this context, e.g.
=TEXT(L2,"m/d/yyyy")&" "&N2&" "&Q2&" "&P2
With MDY convention, if L2 is formatted as Text prior to entry then keying in 2/23/2015 would preserve that display in a formula that concatenates it with other strings. Similarly if not keyed but entered with Ctrl+:.
If L2 is formatted as General or Short Date the date index will be concatenated (42081 in the example above) though the display in L2 will not change.
While a change in formatting may be the most likely explanation (and a solution provided by #barry) another possibility is a change in the date convention from DMY. In which case 2/23/2015 would have displayed and concatenated as that even in a cell formatted as Short Date. 2/12/2015 in that case however would have displayed as such but in the 1900 date system concatenated as 42340 - the date serial number for December 2, not February 12.
I have two columns in Excel, formatted as General - with this data:
Column A Column B
11/2/2014 9:12:27 AM 12/3/2014 2:00:00 AM
How can I find the difference in hours between them, if they are formatted as "General" and not "Date"?
Thank you for any advice,
Mark
I assume that means these are actually text formatted datetimes - you can test by trying to change the format, e.g. try to change to "Number" - if nothing changes theses are text values.
You can still subtract, though, if the datetimes are in a valid format for your region.
Try using a simple subtraction like
=B1-A1
custom format result cell as [h]:mm
I get the result 688:47 (which assumes that the first timestamp is 11th Feb not 2nd November)
Please try:
=VALUE(B1)-VALUE(A1)
custom formatted as[HH].
I am simply importing CSV into Excel, In which I have a date column. it seem like this.
10.22.2014 13:34:00
When I am finish Importing Now I want to convet the whole date column to look like this in the format cell section but it is not working for me. Can you suggest another way. What can be the main reason SUppose i put a formula on the column then Everytime user import the data he need formula which might be not a good idea, Is there something I can do when I m importing or just like wondering what could be done?
10/22/2014 1:34:00 AM or PM
Here's one approach:
Substitute dots with slashes
Use DATEVALUE, TIMEVALUE functions on relevant subsections of this substituted string. Subsections are fetched using LEFT and RIGHT string functions.
These return a serial number for dates (days since 1900) and time (a floating point between 0 and 1). When summed, the value can be represented as both date and time, in a format of your choice, as shown below:
Or, showing formulas:
EDIT: adding all-in-one formula.
Note that this will give you the serial value (41934.5652777778), which can then be formated using the built in formats for dates / times--just select the one you want. This does not actually render a string:
=DATEVALUE(LEFT(SUBSTITUTE(A1,".","/"),10))+TIMEVALUE(RIGHT(SUBSTITUTE(A1,".","/"),8))
If, however, you do want a string returned, you can use the TEXT function.
=TEXT(DATEVALUE(LEFT(SUBSTITUTE(A1,".","/"),10))+TIMEVALUE(RIGHT(SUBSTITUTE(A1,".","/"),8)),"m/d/yyyy h:mm AM/PM")
(This is done in libreoffice, but the same formulas and arguments exist in MS Excel)