In excel I currently have data in date time format
For example: "11/10/2007 8:40:58 PM"
I am trying to extract the date and if the time is PM, I add a day.
if the time is AM, the date remains the same.
So since the time is 8:40:58 PM I would want 12/10/2007.
Is there a way in excel to do such a thing using formulas?
Please consider using the following formula. This uses the fact that in Excel in its date-time code uses 1 to represent a full day and fractions to represent the time. If timestamp is in A1 then:
=INT(A1)+IF((A1-INT(A1))>=0.5,1,0)
Regards.
This one works for me.
=IF(A1>0.5, A1+1, A1)
In order to have it only return the date right click on column B, select "Format" the take your pick.
Related
Minor thing and not sure if on the right place to ask.. but; I have a large dataset with dates, some of then have the correct date stamp, others are just a string of numbers and time which forms an optical date, but isn't. I figured out it has something today with a double space.
12/12/2016 13:01:32 PM
12/12/2016 12:33:46 PM (this one has 2 spaced between 2016 and 12)
the last one is the correct format for a date stamp
research:
http://www.mrexcel.com/forum/excel-questions/502863-extract-am-pm-text-date-time.html
Got it, the problem was in the data set.. with text to column I separated the date time and PM/AM.. then I can get the date and time separate and delete the last column.. thanks for your interest
I am trying to figure out if this is an Excel bug or just a formatting issue. So I have a column with a date and time in the format m/d/yyy h:m AM/PM (ie. 10/21/2015 2:21:00 PM), and am trying to split it into two individual columns: one with the date and one with the time. I tried using fixed width first, but ended up using delimited just so I could split it exactly where I wanted.
For some reason when it splits the two up, the actual value for time changes. I will end up with one column with the date and a time of 12am (10/21/2015 12:00 AM) and one column with the initial time minus 12 hours (2:21:00 AM).... Trying to figure out why there is still a time value in the date column and why the time value changes. Ideally I want to have a column with 10/21/2015 and another with 2:21:00 PM.
I've tried changing the format of the initial date/time combination etc. and it keeps on subtracting 12 hours from the initial time when it splits.
Has anybody experienced or heard of similar issues?
I think your question is confusing, for example I tried using fixed width first, but ended up using delimited just so I could split it exactly where I wanted. seems back-to-front, but you have a datetime value for October 21, 2015 14:21 hrs, want that as a date in one column and 02:21:00 PM in the next and your environment is UK style (ie day before month).
IF so Text to Columns may be as confusing as helpful. Format the date column as date (to suit) and the time column as hh:mm:ss AM/PM (or similar) and the following formulae may suit, assuming your datetime value is in A1:
For date: =INT(A1)
For time: =MOD(A1,1)
It's just as the title says, I cannot convert the serial numbers generated from the DATE and TIME function to a Date and Time Format.
I have this date: 27/11/2012 1:09 PM (originally typed in as text and not acknowledged as date and time, because it was aligned to the left). So instead, I decided to use the DATE and TIME function like so:
=(DATE(2014,8,26) & TIME(13,27,0))
It resulted with a serial number. So I googled on ways how to convert the serial number to a date format. OF course, I already tried formatting a cell by right-clicking it and selecting the Date category but still no luck.
Now that I think about it, is the formula above alright? I mean is it okay to use date and time in one cell? By the way, the dates and times were manually typed in in one cell. And I do not have an option to segregate each date and time elements per cell.
UPDATE: So I tried doing it with just the DATE function only and the formatting worked. Is there any way that even the time is included?
=(DATE(2014,8,26) + TIME(13,27,0))
Use "+" for date and time concord-nation :)
I have an emulator in eclipse.
Did i need another things?
Excel stores time internally the same way as date - i.e. 1 equals one full day, namely January 1st, 1900. Thus, one hour is 1/24. Assuming that only the time was entered into the cell (and not a full date with a time), you could therefore use this formula:
=IF(U7>16/24+50/(24*60),U7-(16/24+50/(24*60)),0)
Alternatively, you could use Excel's TIME function, which converts hours, minutes and seconds into an Excel time:
=IF(U7>TIME(16,50,0),U7-TIME(16,50,0),0)
In case your input cell is a full date with a time, you need to either get rid of the date in the input value - or add the date to the comparison - though I'd recommend the former:
=IF(TIME(HOUR(U7),MINUTE(U7),SECOND(U7))>TIME(16,50,0),U7-TIME(16,50,0),0)
Go through the following article, I hope this will help you.
compare time in excel
You should compare time in following way -
U7>TIME(16,50,0) inside the IF condition.
Please make sure that the column U7 which you use as time input, should be in proper Time format.
Thanks.
I am trying to calculate the hour difference between two times. What I've been doing now only gives me hour indications like 1:30, 2:45, etc but I can't make diagrams based on these values. If I get 2:30 as the hour difference, it should become 2,5. if the difference is 2:45 that should be 2,75.
Change your formula to:
(B2-A1)*24
and format as General
You should just be able to subtract 1 datetime from the other. Try this:
In cell A1, enter "09/17/2012 10:00" (Excel should automatically recognize this as a date)
In cell A2, enter "09/17/2012 11:30"
In cell A3, "=(A2-A1)*24". The result is 1.5.
The problem may be that you are trying to subtract 1 'time' from another 'time' without a date component. In that case, Excel may not recognize your value as a 'time'. Try adding a dummy date to the beginning of the time.
One limitation of this is that you will get an error response of "########" if the 2nd date is earlier than the 1st (because the result is negative). If this is an issue, try "=ABS(A2-A1)*24" instead.