Convert time (text) to Excel formatted Time - excel

I have a list of durations in minutes used to log calls and I want to use Excel to format them and do some calculations. However, these are just exported as table and when I attempt to bring them into Excel, the cells won't format correctly.
An example below:
01:00 is entered as the number of minutes and seconds
However, when I try to use Excels cell format it turns it into
01:00:00 as in hours, minutes, seconds (hh:mm:ss).
Now I want to convert it to this as I also have the cost per minute which I then need to multiply by this time.
To clarify further as to why it needs to be in this format, is because i want to use the follow query to get the total cost per minute.
=(HOUR(H4)*60*I4)+(MINUTE(H4)*I4)+(SECOND(H4)/60*I4)
Can anyone help with how to get Excel to recognise this in mm:ss format.

Try this workaround. Format A column to be "text" type. Paste your data into column A. Format B column to be "custom" type, choose "mm:ss". Copy below formula down column B.
A1: 01:00
B2: =0+("00:"&A1)
B column will display and function as you desire.

Related

Suggest me to customize excel with date formats

In the image attached, I need employees to manually enter login and logout times in the format (HH:MM AM/PM) only. And In the column E I need a formula to calculate hours and minutes of duration in between.
I have tried with =text(D2-C2,"h:mm") formula and when I applied the same to all the columns, they're updating with existing empty cells and resulting 00:00 in the E column.
I only need to update column E only when C and D column values are updated.
Can someone please help me in this regard? I need time frame as 12Hour format.
You can use =IF(AND(C1<>"",D1<>""),D1-C1,"") in your No Of Hours column to calculate only if Log In Time and Log Out Time are filled.
For formatting, you can use Custom Format - h:mm for the No Of Hours column.
1, Try not to convert real time to text.
Use this formula in F2 then fill down. =E2-D2+AND(E2<D2, E2>0) This should also work if the shift spans midnight.
Use this custom number format hh:mm_);;; on the cells.
Example:

Copy pasteing concatenated date time values from Excel in the same format as it's seen in Excel

I have date time cells in Excel. I have a column that concatenates those date time cells.
When I copy paste a value from a date time cell to, say, notepad++, the value shows correctly, like: 6.1.2016 23:00
But when I copy paste the contents of the column that concatenates all the date time values, the values show in following format: 42375,875
I need to copy paste from excel to an sql script, and of course sql thinks that the comma separates two different values, which isn't the case.
How I can copy paste all of them in this format: 6.1.2016 23:00 and NOT in this format: 42375,875
try like this
note : i have have used here m.dd.yyyy date format. you can change it as per your requirement
=TEXT(DATE,"m.dd.yyyy ")&TEXT(TIME,"hh:mm")
if dates are in Column A and time in Column B
paste this formula in column C
=TEXT(A2,"m.dd.yyyy ")&TEXT(B2,"hh:mm")
42375.875 is the internal representation of the DateTime value (1/6/2016 9:00:00 PM) and it seems correct. Just set the Excel Cell format to Date (from Menu) and it should display the correct Date value. T-SQL will DateTime field should also recognize the number 42375.875 representing the correct date. Hope this may help.

Excel date conversion and grouping

I have 20 years of week dates and their corresponding values. The date format is yyyy-mm-dd (the data is not in date format but just in this format on excel), and each of this has a corresponding value. I need to find daily, weekly, monthly, yearly averages. Since the data is too big and I can't find them manually.
Is there any way I can first convert this non-western type of date into some date types and then use some excel functions to do my calculation?
Thanks
If yyyy-mm-dd is text you should be able to convert to number by entering 1 somewhere and copying that, then selecting all the text to be converted and Paste, Paste Special..., check Multiply, OK.
You don't mention what you are averaging (a total divided by number of days/weeks/months/years involved?) but if just counting by day/week/month/year then a PivotTable should be very useful (dates for ROWS and Sum of values for VALUES), with grouping of rows to suit.

How to add a number to a timestamp in Excel

I've got two columns, one of them is a timestamp field with the format as yyyy-mm-dd h:mm:ss and another is a Duration_in_hours column which has a number.
I need to add the duration to the h. Any suggestions on how I can go about doing so?
EDIT:
The cell format for timestamp is 'Custom' (If that matters).
If you simply need to add the hours and let the formatting do the rest (i.e. if there's enough hours in h to change the date dd, then change the date as well, and any other applicable fields), then you simply do it like this:
=A1+(A2/24)
Where:
A1 has the timestamp field.
A2 has the duration in hours.
This works because a unit of 1 in excel is equivalent to 1 day. Dividing by 24 gives it in terms of hours.

Excel 2010: Hours and Minutes extract from hh:mm:ss formatted cell

For example:
I have a cell with the following value:
"1/11/1900 4:00:20 AM"
that will be displayed inside the cell as: "268:00:20" - meaning 268 hours, 00 minutes and 20 seconds (see the first image below).
EDIT:
Here is screen of how it looks like and the formatting of the cell
Here comes the Question:
What is the Excel 2010 formula (no VBA if possible!) to extract hours and to extract minutes from this cell, such as "268" should be shown for hours in a different cell and "00" (in this case) for minutes in another cell?
For clarification: the "268:00:20" is a duration of 268 hours and 00 minutes and 20 seconds.
What I'd like to get? In different cells, store the hours (268) and minutes (0)
The cell is formatted as Time (see the image below):
The value 1/11/1900 4:00:20 AM is really only a formatted number in Excel representing the number of days, i.e approx 11.167 in this case - I think Daniel's solution is not far off - using DAY and HOUR will work for values up to 31 days.......but for a more generic solution for hours use just:
=INT(A1*24)
and for minutes
=MINUTE(A1)
I would use something similar to what I used here. It's not really pretty for a solution but it works.
So, in your case what you do is:
Format the values in the time you want to, and copy/paste the value
(or column) into notepad. The clipboard copies and pastes what's visible
instead of the date/time value in excel.
In your worksheet, insert a
new column and format it as text. This will cause excel to accept
the values as is and not convert them into date time.
Copy everything from notepad and paste into the new column you just
formatted as text. You will get the values of the time as is in
excel.
From there, you can use a Text to column with colon delimited to split the time to get 3 columns: hours, minutes and seconds (and additional tip, in the split to column window, where you are asked about the format of the split columns, format all as text).
EDIT: Since it doesn't seem too obvious...
Column B is the original date/time.
Column C is the same date/time
formatted in hours, minutes and seconds only. Copy and paste column C
in notepad.
Format Column D as text, then copy the values in notepad
to the column. This gives you the time stored as text.
Column E to G is the split of column D, colon delimited.
You do not need any formulas at all. Just format the cell with this format [h]:mm:ss;#
Example below:
Say your date is in Cell A1 as shown:
Go to format options:
Then Under the Number Tab Select Custom. Then enter the above Custom time format into the box:
And your cell will end up as:
Or by formula you could do it using DateDif() with the formula =DATEDIF(0,A1,"D")*24+HOUR(A1)&":"&MINUTE(A1)&":"&SECOND(A1)
as shown below:
You will have to use Day and Hour formulas.
The Hours will return only the time part.
You will have to sum it with 24*Day. Maybe you will need to use Year as well, depending on what you want.
For the minutes, use Minuteformula.
If there's a start date and the desired date, you can use 24 * Days(DesiredDate, StartDate).
Just use Text To Column function under Data in the Menu Bar. Works really well for time that is more than 24 hours. I had a problem where the minutes and seconds were displayed inconsistently sometimes in 2 digits and sometimes in 1 digit eg. 268:1:13 or 541:12:3 or 671:45:30. In that case just select delimiter as ":" (vs Fixed Width option) and it will be able to display the Hours Minutes and Seconds in separate columns. Problem Solved!

Resources