Change decimal number directly into hour in Excel - excel

I need to convert lots of numbers that represent hours, into actual Excel values formatted like hours.
In e.g., I have a cell that has the value "16.30", and I need it to be "16:30".
I tried replacing the dot with two dots, formatting the cells with a custom format like "00:00" and "hh:mm", but nothing works. Excel returns an error or changes the value of the hour by converting the numeric value into an hour, as usual.
Any ideas about how to achieve the goal listed above?
TL;DR: how to change a cell with a value "16.30" into "16:30" as an hour?
Thanks in advance

One way to make your idea of substituting ":" for "." work is like this:
=TIMEVALUE(SUBSTITUTE(TEXT(A1,"0.00"),".",":"))
if A1 contains 16.3 and A2 contains the above and is formatted as time then it will display as time.

You can use this:
=TIME(INT(H6),(H6-INT(H6))*100,0)
Where H6 is your cell. Then format it as you want.

Related

Separate out the date and time from the column

How do I separate date and time from this 2006-09-02T01:07:59.100 I’ve tried =int(A2) but it gives a value error. Please help.
in the column for Date put this formula: =left(A2,10), for the time: =right(A2,12)
Not sure what your purpose is. Display date and time separately or actually have two different values in different cells.
Excel does not play nice with "T" in the middle of the timestamp. You must remove "T" using a string function. Once you have done that your value will format nicely as a date. INT works for the date part, MOD works for time, format cells accordingly.
If display is the only requirement, put the same value in both cells and use cell formatting -- one for Date, one for Time.

Excel not properly comparing dates, despite same cell format

I have two date rows. Both are formatted as dates. When I do a logic test to see whether the two dates, excel is not recognizing them as the same.
Here is a screenshot of the cells:
This is to confirm that both cell rows are formatted as date:
This is to confirm that the equality check row is referencing the right cells:
I'm stumped. Does anyone have any idea what's going on here? Thanks
If you have confirmed that both are actually dates, and not text masquerading as dates, then time is most likely the issue. Note that time is represented via the decimal such that .5 equals noon.
Assuming you just want to know if the dates match independent of time you can use
INT(G4) = INT(G6)
If you want to compare just the dates use:
=Floor(G4,1) = Floor(G6,1)
Format can mask the real cell value. Format both cells as General, then you can see the difference.
If a cell stays a "date" when it is formatted as General, then the cell is most likely text, not a date.
When formatted as General, you can clearly see if the number has any decimals, i.e. time on top of the date.

Date_time format does not recognise AM/PM

I have the following time series dataset from ebuttons.
When I extracted something wrong happened and in most of the data of each buttom I get some times formatted as follows
I have tried several things
1)= text(cell number , "hh:mm:00) in excel
2)I have also tried to separate date and time in excel by holding date constant
3)In rstudio I have used different function as as.POSIXct(concrete$time_date, format = "%m-%d-%Y %H:%M:%S") and as.Date
But there is something really wrong as I get this when trying option 1 and 2 in excel:
I think the time AM/PM whatever I tried is recognized as a text. But I do not know what else to try after having change format in different ways.
I am working on MAC
I really appreciate our attention in advance,
Best
Mara
Considering A1 as the first cell with data, try this one:
Select column B and give format as short date in the way you need.
Select column C and give format as Hour in the way you need.
On A2 place formula =MID(A1,1,8) (Maybe instead of 8 is 9, but check your data)
On A3 place formula =TIMEVALUE(MID(A1,9,20))
Drag the formulas down.
Hope it helps!

Extract characters from a cell with format h:mm

*I use Excel in spanish.
I have a cell with format h:mm (A1 = 07:35), and I want to extract the first two characters in one column (B1=07), and the others into a different one (C1=35).
When I apply the EXTRACT formula (B1=EXTRAE(A1;1;2), C1=EXTRAE(A1;4;2)), it does not throw the numbers that I ask, because of the format, the formula only recognize TEXT format, not h:mm (it shows B1=0, and C1=30, because A1=0,330555556 in text format).
What formula does what I want or how can I get the numbers that I need?
Thanks.
EXTRAE is a version of MID() function in English and MID function works on text values as you indicated. So first convert the cell into a text value and then extract
=MID(TEXT(A1, "hh:mm"), 1, 2)
From your example I believe you are try to extract the Hour and the Minute components of a time. If you want the Hour or Minute of a time value use the =HOUR(A1) Function for extracting the hour and the =MINUTE(A1) Function for extracting the minute.
Format the cells to be 00 so that the cells show two digits for values below 10.
Don't know their equivalent functions in Spanish but hopefully that gives you a point in the right direction.
If your time is stored as text, you will need to parse it somehow. In the simplest case, you can use IZQUIERDA() and DERECHA() to get the leftmost or rightmost characters respectively.
=IZQUIERDA(A1,2) and =DERECHA(A1,2)
If your times are stored as a date, you should use
=MINUTO(A1) and =HORA(A1)
However, if you have a more complex date and are unable to use VBA, you'll have to perform some sort of evil splitting to find it.. For example:
A1
Event 07:35 am
B1 Hour
=IZQUIERDA(RDERECHA(A1,LEN(A1)-SI.ERROR(HALLAR(" ??:??",A1)+1,HALLAR(" ?:??",A1))),HALLAR(":",RDERECHA(A1,LEN(A1)-SI.ERROR(HALLAR(" ??:??",A1)+1,HALLAR(" ?:??",A1))))-1)
C1 Minute which depends on the Hour to function
=IZQUIERDA(RDERECHA(A1,LEN(A1)-HALLAR(B10&":",A1)-1),2)
Here's my attempt at an example demonstration
Disclaimer: the Spanish translations of formulas are according to this internet source

Format all cells in column from date to text

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.

Resources