Excel formula text to minutes - excel

I want to convert text to minutes.
text hours = 8.15 'means 8h 15m
convert to minutes formula
=LEFT(A2,2)*60+IF(ISNUMBER(SEARCH(".",A2))=TRUE, SUBSTITUTE(MID(A2,FIND(".",A2)+1,2),".",""), "0")`
I getting error when calculate "0.15"
Please help, Thanks!

Total minute
=INT(A1)*60+(A1-INT(A1))*100
If want to extract minutes only then use
=A1-INT(A1)

Not clear exactly what you want, or exactly what you are dealing with.
The below assumes that dot is your system decimal separator. If dot is not your system decimal separator, then replace the cell references in the formulas below with: SUBSTITUTE(A1,".","your_system_decimal_separator")
Assuming 8.15 means 8 hrs 15 minutes, you can convert it to Excel time value with:
=DOLLARDE(A1,60)/24
and format the result as time (eg hh:mm or [mm] or similar).
If what you really want to see is the minutes as an integer (not as a time), then use
=DOLLARDE(A1,60)*60
DOLLARDE(A1,60) converts 8.15 to 8 + 15/60 (decimal hours) (e.g. 8.25)
Dividing by 24 or multiplying by 60 converts it either to an Excel time value, or decimal minutes, respectively, as Excel stores time (and dates) as fractions of a day.
Note: If 8.15 is decimal hours and equal to 8:09, then you don't need the DOLLARDDE part of the formula at all

You don't specify if 8.15 means 8,15 hours in decimal (it would be equal to 8 hours and 9 minutes) or if it means 8 hours and 15 minutes, so I developed both.
I guess the problem is that your decimal separator is the comma, and you need to convert the value into numeric.
My formulas for first version:
B5: =VALUE(SUBSTITUTE(A5;".";","))*60
C5:=INT(VALUE(SUBSTITUTE(A5;".";",")))*60
D5:=B5-C5
My formulas for second version:
B11: =(VALUE(SUBSTITUTE(A11;".";","))-VALUE(VALUE(SUBSTITUTE(A11;".";","))))*100+INT(VALUE(SUBSTITUTE(A11;".";",")))*60
C11:=INT(VALUE(SUBSTITUTE(A11;".";",")))*60
D11:=B11-C11
With this formulas you convert the string into numeric value, and then you work in the decimal system.

You could use
=minute(substitute(a2;".";":"))/100
to get "0.15" from "8.15".

There seem to be two possible problems in your question: either Excel can't recognise your "8.15" as being a timevalue, or you don't know how to calculate the number of minutes from a timevalue.
In case it's the second one, there's an easy formula for this:
=Hour(A2)*60 + Minute(A2)
Meanwhile I keep digging for a while to recognise "8.15" as a timevalue.
If ever you have the possibility to replace the "." by a ":", this might solve your problem immediately.

Related

Extract the hour from the h" hour(s) and "m" minute(s)" in excel

I have the list of data that showing the Hours and the Minutes that I extract from the system. I need to be extract the hours.
As example below, column B first row, the Hours would be 64 and the minutes would be 46.
But when I used the formula =Hour , its turn up the different value since its actually decimal number.
Cannot use left() , it will give the actual decimal number.
Updated:
We tried the #harun24HR 's but cannot readable the value.
But if you noticed, if i copy and paste the value is different. thats why the search not applicable.
4th Update:
To Solar Mike, I have tried the formula given from the thread the i think the value not readable
It's a time value which Excel stores as calculated value based on 24 hours = 1.
To retrieve the hours only you can use:
=INT(A2*24)
To retrieve the minutes only you can use:
=(A1-(INT(A1*24)/24))*24*60
Your time value is already a number in time format so you just need it to change it to decimal system. Dates and time values are numbers. Even if you see it as 30/09/2019 or 12:00:00, actually, for Excel, both cases are numbers.
First date Excel can recognize properly is 01/01/1900 which integer numeric value is 1. Number 2 would be 02/01/1900 and so on. Actually, today is 44659.
Now, about your data, you posted this screenshoot:
So the value is numeric, not text/string. In Excel, what you see is not always what you have. Probably that column has been formatted using custom mask. My fake data is like this:
The numeric value is 02/01/1900 16:46:36 (or 02/01/1900 4:46:36 PM it depends on your regional settings) but I've applied a custom format like this:
[hh]" hours" mm " minutes"
So what I have is a number but what I see is a text!
We have to work with the number (to be honest, ist's easier to work with numbers), so to extract the total hours, minutes and seconds.
Formula in B1: =INT(A1*24) total hours
Formula in C1: =INT(A1*24*60-B1*60) total minutes
Formula in D1: =A1*24*60*60-B1*60*60-C1*60 total seconds
This should guide you on whatever are you trying to achieve.
From your current sample data you try-
For hour =LEFT(A2,SEARCH(" ",A2)-1)
For minutes =RIGHT(SUBSTITUTE(A2," minutes",""),2)

Trying to Sum negative times

I am trying to sum two cells that have hh:mm's in them. Some of these cells may start with a + that I have removed but other are negative.
The highlighted cell has this formula in it.
=SUM(IF(LEFT(R6148,1)="+",RIGHT(R6148,LEN(R6148)-1),R6148),IF(LEFT(R6149,1)="+",RIGHT(R6149,LEN(R6149)-1),R6149))
What I was expecting is that under home 1 will be -05:00 and so on for the other homes.
Thanks
If the Time is Text then you can convert this using below formula then sum it:
=LEFT(A1,SEARCH(":",A1)-1)-(MID(A1,SEARCH(":",A1)+1,2))/69
Excel can't handle negative times, so these cells are presumably either text cells or use a single quote in front of the operator. You need to convert them to numbers before doing the math.
I would suggest separating the operator (+ or -) from the string, converting the hours to a number, and then recombining the operator and the hours. Because you're converting a time in hours to a number, it will be returned as a fraction of a whole day (e.g., 1 hour = 1/24 = 0.0416667), so you would multiply tit by 24 to get back to hours.
=(NUMBERVALUE(LEFT(B2,1)&NUMBERVALUE(RIGHT(B2,LEN(B2)-1)))+NUMBERVALUE(LEFT(B3,1)&NUMBERVALUE(RIGHT(B3,LEN(B3)-1))))*24
A better solution may be to convert all values to decimal numbers instead of times. You'd have to enter minutes as a decimal (e.g., 1 hour and 15 minutes = 1.25 hours), which could be tough for folks to do on the fly without a calculator, so you could provide a helpful conversion table from minutes to decimal hours. Timekeeping is often limited to some minimum interval, so the conversion table could be pretty short (e.g., if it's a minimum 5 minute interval, you only have 11 possible values for 0 minutes through 55 minutes).

Time Study in Excel

I am completing a time study and recording time in excel. I have numbers like 2.24, etc.. I am trying to add them and average them and I am getting numbers like 9.76 when I really want 10m and 16seconds. Any thoughts to fixing this?
When I change the format to mm:ss it give me wild answers
If 9.76 is a decimal number and it's is in A1, then in B1 you can use:
=((A1-(ROUNDOWN(A1;0)))/0,6+(ROUNDOWN(A1;0)))/24
Also, format of cell with formula must be hours (I've used [hh]:mm:ss)
Applying this, I get:
I've done it in the following way: I used cell formatting, like u:mm:ss (in English locale, this might be h:mm:ss instead).
In one cell, I've put 0:2:24 (zero hours, two minutes, 24 seconds).
In the cell below, I've put 0:7:52.
Adding both cells (inside a cell with the mentioned cell formatting) yielded 0:10:16.
=9.76 value(minutes)
=24*60 number of minutes in a day
=A1/A2 formatted as time
Will show 12:09:46. You can use =MINUTE(A3) to extract the minutes and =SECOND(A3) for the seconds.
Actually if 9.76 means 9 minutes and 76 seconds, you'll need more formulas to extract the minutes and seconds then add them together. You can use =Floor() to get the integer. Subtract to find the .76 and multiply by 100 to get the number of seconds. Then divide by 60 to convert to minutes and add to the 9 whole mins. Now you have the number of mins which you can convert to a time value per the above.
EDIT:
You need to enter in Excel as 0:02:12 then you can add quite nicely. If you don't want to re-enter everything you can do this: =VALUE("0:"&SUBSTITUTE(A1,".",":")) then add. Be sure to convert each individual value BEFORE adding otherwise you might get incorrect results.

Converting unix time into date-time via excel

Trying to convert 1504865618099.00 Unix time into a readable date time.
I tried this:
=(UNIX + ("1/1/1970"-"1/1/1900"+1)*86400) / 86400
But it's not working.
To convert the epoch(Unix-Time) to regular time like for the below timestamp
Ex: 1517577336206
First convert the value with the following function like below
=LEFT(A1,10) & "." & RIGHT(A1,3)
The output will be like below
Ex: 1517577336.206
Now Add the formula like below
=(((B1/60)/60)/24)+DATE(1970,1,1)
Now format the cell like below or required format(Custom format)
m/d/yyyy h:mm:ss.000
Now example time comes like
2/2/2018 13:15:36.206
The three zeros are for milliseconds
=A1/(24*60*60) + DATE(1970;1;1) should work with seconds.
=(A1/86400/1000)+25569 if your time is in milliseconds, so dividing by 1000 gives use the correct date
Don't forget to set the type to Date on your output cell. I tried it with this date: 1504865618099 which is equal to 8-09-17 10:13.
TLDR
=(A1/86400)+25569
...and the format of the cell should be date.
If it doesn't work for you
If you get a number you forgot to format the output cell as a date.
If you get ##### you probably don't have a real Unix time. Check your
timestamps in https://www.epochconverter.com/. Try to divide your input by 10, 100, 1000 or 10000**
You work with timestamps outside Excel's (very extended) limits.
You didn't replace A1 with the cell containing the timestamp ;-p
Explanation
Unix system represent a point in time as a number. Specifically the number of seconds* since a zero-time called the Unix epoch which is 1/1/1970 00:00 UTC/GMT. This number of seconds is called "Unix timestamp" or "Unix time" or "POSIX time" or just "timestamp" and sometimes (confusingly) "Unix epoch".
In the case of Excel they chose a different zero-time and step (because who wouldn't like variety in technical details?). So Excel counts days since 24 hours before 1/1/1900 UTC/GMT. So 25569 corresponds to 1/1/1970 00:00 UTC/GMT and 25570 to 2/1/1970 00:00.
Now if you also note that we have 86400 seconds per day (24 hours x60 minutes x60 seconds) and you will understand what this formula does: A1/86400 converts seconds to days and +25569 adjusts for the offset between what is zero-time for Unix and what is zero-time for Excel.
By the way DATE(1970,1,1) will helpfully return 25569 for you in case you forget all this so a more "self-documenting" way to write our formula is:
=A1/(24*60*60) + DATE(1970,1,1)
P.S.: All these were already present in other answers and comments just not laid out as I like them and I don't feel it's OK to edit the hell out of another answer.
*: that's almost correct because you should not count leap seconds
**: E.g. in the case of this question the number was milliseconds since the the Unix epoch.
If you have ########, it can help you:
=((A1/1000+1*3600)/86400+25569)
+1*3600 is GTM+1
in case the above does not work for you. for me this did not for some reasons;
the UNIX numbers i am working on are from the Mozilla place.sqlite dates.
to make it work : i splitted the UNIX cells into two cells : one of the first 10 numbers (the date) and the other 4 numbers left (the seconds i believe)
Then i used this formula, =(A1/86400)+25569 where A1 contains the cell with the first 10 number; and it worked
You are seeing the date as ######## most likely because by definition the EPOCH times is in seconds - https://en.wikipedia.org/wiki/Unix_time. This means the number should be 10 characters long. Your number has 13 characters (see 1504865618099) and it is most likely in milliseconds (MS). In order to fix the formula just divide the number by 1000. Just keep in mind this way you'll loose the MS precision, but in most cases this is OK. So the final formula should be:
=A1/(86400 * 1000) + DATE(1970,1,1)
Just point and shoot.
Replace the C2 with your cell no. No need to format your Excel cell.
Also, you can use this unixtimestamp website to verify your data.
International format (ISO 8601):
=TEXT(C2/(1000*60*60*24)+25569,"YYYY-MM-DD HH:MM:SS")
2022-10-20 00:04:22
2022-10-20 00:05:20
2022-10-20 00:14:58
US format:
=TEXT(C2/(1000*60*60*24)+25569,"MM/DD/YYYY HH:MM:SS")
10/20/2022 00:04:22
10/20/2022 00:05:20
10/20/2022 00:14:58
Europe format:
=TEXT(C2/(1000*60*60*24)+25569,"DD.MM.YYYY HH:MM:SS")
20.10.2022 00:04:22
20.10.2022 00:05:20
20.10.2022 00:14:58
If you only need the date, remove the 'HH:MM:SS'.
=TEXT(C2/(1000*60*60*24)+25569,"YYYY-MM-DD")

formula works fine with the cell in hh:mm:ss format, but the same formula gives incorrect value in cell with mm:ss format

my data appears as this
WAIT
29:45:00
2:41:14
46:06:00 ' <---
0:25
19:23 ' <---
2:25:12
37:36:00
2:12:24
1:34:35
1:54:13
13:00:53
when i am applying the formula =HOUR(F7)*3600+MINUTE(F7)*60+SECOND(F7) to 46:06:00, it gives the correct answer, however when same formula is applied to the 19:23, excel recognizes 19:23 in HHMMSS format, however it is MMSS...
i have a huge data base and it would be very difficult for me to change it manually....
please help...
By default, Excel treats numbers in the format xx:xx or x:xx as h:mm, and NEVER as mm:ss.
I don't see a way to transform the values into valid hh:mm:ss, since there is no handle for Excel to determine which number is lacking the hour part.
The best option is to change the routine that writes the data and have the hour entered as 00: before a mm:ss value.
As long as the data column is formatted as text, you could test how many colons exist in the string and apply a different calculation depending on whether there is 1 or 2. If there is only 1 colon, then use what Excel thinks is the hours as the minutes, and what Excel thinks are the minutes as the seconds.
=IF(LEN(F7)-LEN(SUBSTITUTE(F7,":",""))=2,HOUR(F7)*3600+MINUTE(F7)*60+SECOND(F7),HOUR(F7)*60+MINUTE(F7))
It's difficult to tell whether your data is text-formatted or not - HOUR/MINUTE/SECOND functions work just as well on text-formatted times as real times. What result do you get with this formula?
=ISNUMBER(F7)
If that gives you FALSE then your "times" are text formatted in which case this formula will give you the total seconds:
=LOOKUP(999,({"","0:"}&F7)+0)*86400
format result cell as general
That will interpret 19:23 as 19 minutes 23 seconds as required. For 46:06:00 you will get the result 165960, the total seconds in 46 hours and 6 minutes. Your formula is giving you just the seconds from the remainder after multiples of 24 hours are removed, as pnuts points out. That's because
=HOUR("46:06:00")=22
If you want the result to be 79560 then you can add a MOD function like this:
=MOD(LOOKUP(999,({"","0:"}&F7)+0),1)*86400
The LOOKUP function works here because it exploits the fact that concatenating "0:" to the start of 19:23 (and then doing a calculation like +0) converts 19:23 (19 hours 23 minutes) to 0:19:23 (zero hours, 19 minutes, 23 seconds) but concatenating 0: to 46:06:00 and then adding 0 gives you an error.
Guyz, thx for answering the question..
here is what i tried-
first i applied
=TEXT(D2,"hh:mm:ss") formula to the cell value and then used =IFERROR(SUMPRODUCT(("00:"&d2)+0),d2), so 19:23 got changed to 00:19:23..
It worked though i had to do some manual work on the data...

Resources