Converting MM:SS.ms to seconds using MS excel - excel

I am looking for a neat way of converting a cell from
Minutes:Seconds.Milliseconds to
Seconds.Milliseconds
i.e.
11.111 = 11.111
1:11.111 = 71.111
I have something in place at the moment but its a bit hacky and I am sure there must be some nice excel feature to do this for me :P
Thanks!

Do this:
Place values 0:0:11.111 and 0:1:11.111 in cells B3 and B4 respectively.
Now format it to account for the milliseconds... Select cells B3 and B4, right click and choose Format Cells. In Custom, put the following in the text box labeled Type:
[h]:mm:ss.000
Now on cell C3 put the following formula:
=B3*86400
Fill C4 with the same formula...
Format column C as Number with 3 decimal places.
You're done! :)
Here's a screenshot of the attempt I made and that worked:
Edit:
As you wanna enter only MM:SS.ms you can format the entire B column with a custom format like: mm:ss.000. Now you can enter values as 02:11.111 and it'll convert it accordingly giving you 131.110. Hope it helps.

say your time is in cell A1, place this formula in B1
=IF(LEN(A1)>5,VALUE(TEXT(A1,"[ss].00")),A1)
If the time is less than a minute it outputs the time unaltered, greater than 1 minute it converts it to seconds & milliseconds (2 decimal places).
This will only work if your time in A1 is 10 seconds or greater.

Related

Converting MMM:SS format into HH:MM:SS

I have a user input which is given in the form MMM:SS e.g. 103:23 which I want to convert into a normal time format i.e. for the previous example 103:23 would be 01:43:23. Is it possible to do this using an excel formula?
This formula should do it, change A2 to reference the cell then input is in
=TIME(0,LEFT(A2,SEARCH(":",A2)-1),MID(A2,SEARCH(":",A2)+1,LEN(A2)))
This can be done simply by using the formula below where cell C5 is your input time
=TEXT(CONVERT(C5,"min","hr"),"hh:mm:ss")
Sample
If the input in cell A1 is text:
This formula returns a decimal number representing the time:
= TIMEVALUE( "00:" & A1 ) 'Change the `NumberFormat` to: `"HH:MM:SS"`
This formula returns a text representation of the time:
=TEXT(TIMEVALUE( "00:" & A1),"HH:MM:SS")
If the input in cell A1 is a number, it means that the NumberFormat of cell A1 is [mm]:ss:
This formula returns a decimal number representing the time:
= A1 'Change the `NumberFormat` to: `"HH:MM:SS"`
This formula returns a text representation of the time:
=TEXT( A1, "HH:MM:SS" )
in my case I have a limited max time limit so I was able to just write the following based on all of your inputs above. If anyone has any optimization suggestions for the code please feel free to share but this seems to work for the inputs that I have tried.
=IF(E3>=420,CONCATENATE("07:",(TEXT((LEFT(E3,3)-420),"00")),":",RIGHT(TEXT(E3,"0.00"),2)),
IF(E3>=360,CONCATENATE("06:",(TEXT((LEFT(E3,3)-360),"00")),":",RIGHT(TEXT(E3,"0.00"),2)),
IF(E3>=300,CONCATENATE("05:",(TEXT((LEFT(E3,3)-300),"00")),":",RIGHT(TEXT(E3,"0.00"),2)),
IF(E3>=240,CONCATENATE("04:",(TEXT((LEFT(E3,3)-240),"00")),":",RIGHT(TEXT(E3,"0.00"),2)),
IF(E3>=180,CONCATENATE("03:",(TEXT((LEFT(E3,3)-180),"00")),":",RIGHT(TEXT(E3,"0.00"),2)),
IF(E3>=120,CONCATENATE("02:",(TEXT((LEFT(E3,3)-120),"00")),":",RIGHT(TEXT(E3,"0.00"),2)),
IF(E3<60,CONCATENATE("00:",(TEXT(LEFT(E3,2),"00")),":",RIGHT(TEXT(E3,"0.00"),2)),
IF(E3>=60,CONCATENATE("01:",(TEXT((LEFT(E3,3)-60),"00")),":",RIGHT(TEXT(E3,"0.00"),2)),
))))))))

Finding Random Time between given range using Randbetween function in Excel

I wish to find a Random Time between a given Time range containing Time format HH MM SS using a Randbetween function from excel. I just google around and came to know below function helps to get the result i need. but i need an explanation as i dint understand how this formula works. eg i dont know why it use 0 here and multiply and divide by 1000
=(RANDBETWEEN(0,($B$14-$A$14)*10000)/10000)+$A$14
B14 is ending time eg: 8:30
A14 is starting time eg: 7:30
Say we have two genuine times like:
9:15:23 AMand2:34:21 PM
If we first convert both times into integer seconds, we can use RANDBETWEEN(). Place the values in A1 and A2
then in B1 enter:
=A1*24*60*60
and copy downward.
In C1 enter:
=randbetween(b1,b2)/86400
and format as time:

Excel convert date to text retaining date layout

I have rows containing every Monday and Sunday in an entire year, (with variations on when a month starts and ends) like so,
11/05/2015 18/05/2015 25/05/2015 01/06/2015 08/06/2015
17/05/2015 24/05/2015 31/05/2015 07/06/2015 14/06/2015
However these are in the date format, and I need them in a text format, but so they still read in the dd/mm/yyyy format, not like 42125.
Further up my document, each column header should read dd/mm/yyyy-dd/mm/yyyy using each of the dates shown in my first example, and I was hoping to achieve this using the formula =A30&"-"&A31 and so on. So the desired outcome should read,
11/05/2015-17/05/2015 18/05/2015-24/05/2015
11/05/2015 18/05/2015
17/05/2015 24/05/2015
However using the =cell&cell formula im left with
42135-42141 42142-42148
11/05/2015 18/05/2015
17/05/2015 24/05/2015
I have to create these headings for 2 years worth of dates, and trying to avoid typing every heading out manually, is there a way to achieve this?
Use the TEXT function which comes with Excel.
Assuming cell A1 has "11/05/2015", use the following formula in cell B1:
B1=TEXT(A1,"dd/mm/yyyy")
This takes care of the first part of your question. For the second part, you can use the CONCATENATE function. Assuming that B1 and B2 contain dates as text, you can join them together using the following formula:
=CONCATENATE(B1, "-", B2)
Try converting those values to text before concatenating:
=TEXT(A1,"dd/mm/yyyy")&"-"&TEXT(A2,"dd/mm/yyyy")
You need to break them down like so:
=DAY(A3)&"/"&MONTH(A3)&"/"&YEAR(A3)&"-"&DAY(A4)&"/"&MONTH(A4)&"/"&YEAR(A4)
I am assuming here your data start from cell A3
Assuming headings in row 1 and dates in rows 3 and 4 this will work:
=TEXT(A3,"dd/mm/yyyy")&TEXT(A4," - dd/mm/yyyy")
without having to concatenate " - "

How to convert INR number format into European number format in Excel with Formulas?

Following is the which I am trying :
Let this number 6,123,456.33 in Cell A1,
Then in Cell B1 use this formula =TEXT(A1,"#,###,###.##"), will give you 6,123,456.33.
Then in Cell C1 use this formula = SUBSTITUTE(B1,",",".") ,will give you 6.123.456.33
Then in Cell D1 use this formula =","&RIGHT(H12,2), will give you ,33.
Then again come to Cell C1 Do text to columns or other options to remove the last digits with decimals and then concatenate result with Cell D1 shows the last three digits.
This tip will ends up in 6.123.456,33
But Problem is in point no. 5.
How should I remove .33 from cell C1?
TRUNC is not working on C1.
Any Suggestions ?
Seems like you don't mind having the result as text (and I can't seem to find a way to custom format it...) and as such, you can use the formula:
=SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(TEXT(A1,"#,###.00"),",","#"),".",","),"#",".")
There's a triple substitution, one to remove , for # (a dummy character), second to change . to ,, then last from the dummy # to ..
If A1 is always a 7 digit number with 2 decimals then you could use TEXT function like this:
=TEXT(A1*100,"0\.000\.000\,00")

excel formula to combine 2 cells into 1 in specific format

I have 2 cells, one cell has just text A1 cell, text (hello) other cell B1 has a timestamp (3:55). I need to combine these cell to one with this format: hello#t=3m55s, or if timastamp is 1:12:11 format will be hello#t=1h12m11s. So cell A1 will change to this specific format base on B1 cell.
Thank you.
You could try this formula:
=A1&"#t="&IF(HOUR(B1)=0,"",HOUR(B1)&"h")&MINUTE(B1)&"m"&SECOND(B1)&"s"
The & concatenates each part together. However, if the timestamps are not correct for the mm:ss times, then it won't work.
EDIT: To deal with the issue of timestamps:
=A1&"#t="&IF(SECOND(B1)<>0,HOUR(B1)&"h"&MINUTE(B1)&"m"&SECOND(B1)&"s", HOUR(B1)&"m"&MINUTE(B1)&"s")
The issue with this is that it won't work for timestamps of the type "11:11:00" But I don't think there's much to be done, unless the string is first converted to text, which I could give some pointers on.

Resources