I need to operate on values greater than 9999:59 (up until 20000:00) in Excel. I used [h]:mm format but it seems it is not possible to do operation (like summation of two column) for values greater than 9999:59.
I already have the data so it's not possible for me to write it in another format.
I tried other formats such as [hhhhhh]:mm and [HH]:MM which my colleagues told me but they didn't work too.
Is there any way to do this?
You can certainly operate on time values > 9999:59:59
But you cannot directly enter values greater than 9999:59:59 into a worksheet cell:
From Excel Specifications and Limits:
Largest amount of time that can be entered: 9999:59:59
The reason for your #VALUE! error in I3 is because, when you entered 1000:12 into H3, since it is greater than the amount that can be directly entered, Excel has changed it to a text string.
But see this:
The formula:
H3: =H2+TIME(0,13,0)
If you must work with directly entered times greater than 9999:59:59, then you can enter that time differently in some other column, and use a formula to convert it:
For example, enter the time as a decimal number, where the decimal represents the minutes (be sure to use leading zero's for minutes < 10. eg 1 minute = 0.01)
F4: 10000.12 10000 hours 12 minutes
H4: =DOLLARDE(F4,60)/24
Related
I have a string of consecutive dates in an excel table that represent when items were picked up from a store. I need to determine either if any gap is more than 60 days or the greatest gap. Example:
9/5/18, 9/18/19, 11/20/18, 12/21/18
The gap between the 2nd and third dates is the greatest at 63. I either need the "63" or a "yes" if >63. I have a few hundred rows of these dates so looking for a formula without the need to build helper tables.
Thanks in advance.
IF the dates are in different cells:
=MAX(B1:D1-A1:C1)>60
Depending on one's version this may need to be confirmed with Ctrl-Shift-Enter instead of Enter when exiting edit mode.
If they are in the same cell, comma delimited:
=MAX(FILTERXML("<a><b>"&SUBSTITUTE(A1,",","</b><b>")&"</b></a>","//b["&ROW($ZZ$2:INDEX($ZZ:$ZZ,LEN(A1)-LEN(SUBSTITUTE(A1,",",""))+1))&"]")-FILTERXML("<a><b>"&SUBSTITUTE(A1,",","</b><b>")&"</b></a>","//b["&ROW($ZZ$1:INDEX($ZZ:$ZZ,LEN(A1)-LEN(SUBSTITUTE(A1,",",""))))&"]"))>60
Depending on one's version this may need to be confirmed with Ctrl-Shift-Enter instead of Enter when exiting edit mode.
If the dates are all in a single cell, and you have a recent version of Excel with the SEQUENCE function, you can use:
=AGGREGATE( 14,6,DATEVALUE(TRIM(MID(SUBSTITUTE(A1,",",REPT(" ",99)),SEQUENCE(10)*99,99)))-DATEVALUE(TRIM(MID(SUBSTITUTE(A1,",",REPT(" ",99)),IF(SEQUENCE(10)=1,1,(SEQUENCE(10)-1)*99),99))),1)
where the 10 argument for SEQUENCE is just some value greater than the total possible number of included entries.
If you do not have the SEQUENCE function, you can use something like:
=ROW(INDEX($A:$A,1,1):INDEX($A:$A,255,1))
I prefer to make that a named formula, and name it seq, so the final formula would look like:
=AGGREGATE( 14,6,DATEVALUE(TRIM(MID(SUBSTITUTE(A3,",",REPT(" ",99)),seq*99,99)))-DATEVALUE(TRIM(MID(SUBSTITUTE(A3,",",REPT(" ",99)),IF(seq=1,1,(seq-1)*99),99))),1)
Date-Times in excel are in days since the epoch, floating point, with a presentation number format that you can adjust (I like YYYY-MM-DD iso date). It should be easy to convert your strings to dates, if they are not already dates by automatic conversion. I bet there is a function for that! Subtract them, but since the are date-time floating point numbers with fractions, you might need to find a function named int or integer to scrape off any fraction. Of course, if they all lack time components, that part defaults to the same time, so the subtraction returns whole days.
I have a cell A3 as 10.55 and B3 as 20.35. Now i have to calculate the different value as time. It means i should get the value like 9 hours and 40 mins. it should print like 9.40 in the C3.
I have tried this but it is not give the exact value.
=TIME(FLOOR((B3-A3), 1), ((B3-A3) - FLOOR((B3-A3), 1)) * 100, 0)
Is there any other way to solve it ? Thank you in advance.
If you use the native Excel time format 10:55 and 20:35 instead, you can simply do a substraction to get your desired result.
A3:
=TIME(10;55;00)
B3:
=TIME(20;35;00)
C3:
=TEXT(B3-A3;"g.mm")
Should work. ;)
First, you need to set the number format in all 3 cells as h.mm (Right click on cells, Format Cells..., Number tab, Custom category).
Then, when you enter the time it should be in the standard format 10:55, otherwise it will be consider as number, indeed. Why this happens: MS Excel consider all dates as numbers. The integer part are the number of days since 1900, the fractional part are the hours. The difference between number and date is only the number format as number or as date/time.
If you do like this, if simply use the formula =B3-A3, you will get the time difference.
I have a time sheet and I need to calculate the difference between two time values. As this sheet will be made available to all employees, I cannot make use of the 1904 date system hence I resolved to using this
=IF(A1-B1<0, "-" & TEXT(ABS(A1-B1),"hh:mm"), A1-B1)
This works and gives a negative sign to the negative values thereby overcoming the hashes ####### problem and display in Excel 2007 and higher.
Yet I cannot create conditional formatting to the result as it is obvious that the values are interpreted as text and neither can I count a group of these values with a simple summation.
Edit 1
AFAIK there is no really good way to do this in Excel. The best I have found if you want to keep the numeric time value and can't use 1904 dates is to use a custom number format like the following:
hh:mm;-[m]" mins"
This displays positive times normally and negative times as a number of minutes. So +1:45 will display as 01:45 and -1:45 will display as -105 mins. Or for consistency you could just go for:
[m]" mins"
Which formats everything as minutes.
This works because the "elapsed time" formats ([h], [m], and [s]) do handle negative times. Unfortunately you can't have more than one in a format, and [h]:mm just triggers the hash signs again.
You could use conditional formatting.
For your formula:
C1: =ABS(A1-B1)
For your Conditional Formatting formula:
=A1<B1
If you also want to have a negative sign (or parentheses) around the value, you can also go to the Number tab of the conditional formatting format dialog box, and enter an appropriate string in the positive number field.
Be careful as the values in Column C will always be positive, so do not use them in subsequent calculations. Use the original values in A1:B1 to determine whether to add or subtract
I am trying to make data collected in 15 minute increments look like data collected in 5 minute increments with the blank spaces being zero. I have created a column with Julian date/time in 15 minute increments (A) and a column with Julian date/time in 5 minute increments (C) and the 15 minute increment data is in column B. I have created a simple formula to check all of column A for an exact match to column C if true I need it to return Column B corresponding to the match in column A, If false it can return 0.
Here is what I have so far with the ?????? being the missing True return formula. What is the formula to return the corresponding data in column B?
=IF(ISNUMBER(MATCH(C2,D:D,0)),"?????????","0")
The common way to handle this sort of lookup is using INDEX-MATCH. You may also be able to use VLOOKUP but I always prefer INDEX-MATCH.
Picture of ranges shows the 5 minute times in column C with 15 minute data in column F.
Formula in C1 is a combination of INDEX-MATCH and IFERROR. The IFERROR is used to handle the case of a value not found and returning the 0 you wanted.
=IFERROR(INDEX($F$1:$F$11,MATCH(B1,$E$1:$E$11,0)),0)
That formula can be copied down from C1 to the end of the 5-minute times.
Your sample formula looks like it uses different columns that your narrative describes. I will use what I understand from your description as the columns. See my sample image below for clarity.
Time lookups are prime candidates for 15 digit precision floating point errors. This is due to the base nature of time being a decimal portion of a day and the repeating decimals inherent with displaying 60 minutes and 24 hours. This problem is often magnified by using incremental progression vs datum growth.
If you have a base time in A2 and wish to create a series of 15 minute increments from that to fill down the column, do not use something like the following:
=TIME(0,15,0)+A2 ◄ generates incremental error growth
When you fill that formula down, any error is multiplied as you fill down. Your base display of minutes may not show any obvious errors but if it was displayed as seconds you would likely find that an extra second was added or subtracted every several hundred rows. This is known as Incremental Error Expansion where each successive row adds to the error generated by the previous formula. In short, if you have a hundred of these formulas in a column, any error in the first is multiplied by 100 by the last one.
By always basing the sequential time formula on A2, the error is minimized to a
single calculation. Change the formula to something like,
=TIME(0,ROW(1:1)*15,0)+A$2 ◄ datum growth based on minutes added to A2
Even with a datum growth formula you may have some errors on exact matches. Best to wrap the formula in an MROUND function that allows you to round off the returned value to a specified multiple; in this case to the nearest second.
=MROUND(TIME(0, ROW(1:1)*15,0)+A$2, TIME(0, 0, 1))
Fill down to get a progressive column of values with a 15 minute increment. You will likely not see any difference in the displayed values but the raw underlying value that is used for the lookup will be quite different. This principle is know as Datum Incrementing; e.g. all progressive numbers are based on a single calculation against the original.
So with a time value in A2 these are the formulas that should be used.
8:30:00 AM ◄ starting time value in A2
=MROUND(TIME(0, ROW(1:1)*15,0)+A$2, TIME(0, 0, 1)) ◄ in A3 add 15 minutes to A2 (fill down as necessary)
=A2 ◄ starting time value in C2
=MROUND(TIME(0, ROW(1:1)*5,0)+C$2, TIME(0, 0, 1)) ◄ in C3 add 5 minutes to C2 (fill down as necessary)
These will produce the most accurate time increments to be used for an exact match lookup.
Now you can apply a VLOOKUP function or an INDEX function paired with a MATCH function to retrieve the values from column B. An IFERROR function will catch non-matches and output a 0 instead of the #N/A error.
My formula in column D uses an INDEX/MATCH pair. D2 is,
=IFERROR(INDEX($B:$B, MATCH(C2,$A:$A, 0)), 0)
There is an alternate formula in E2 using VLOOKUP,
=IFERROR(VLOOKUP(C2,$A:$B, 2, FALSE), 0)
Caveat: There is a maximum number of minutes that can be applied with the TIME function. This is the maximum positive value of a signed integer or 32,767 (about 22¾ days worth of minutes).
You could eliminate the look-up altogether and just use the index function to reference the cells needed like this:
Regarding Is a comment warning enough when dealing with potential data loss? and =TIME(0,ROW(1:1)*15,0)+A$2 I caution that applied ‘liberally’ there may be the risk of loss of data. May depend on machine specifications etc. but trying to fill most of a column with that formula my Excel crashed (after attempting for most of 1-1/2 hours). I’d be interested in the experiences of others, in part because dealing with the least significant digit might be processor dependent.
On my machine I tried comparing:
=TIME(0,ROW(1:1)*15,0)+A$2
with
=TIME(0,15,0)+B2
Over 1,000 rows (ie about 10-1/2 days of quarter hours) and found differences (computed, so a possible source of further inaccuracy). The main difference being that the latter accounts for day changes (the integer part in Number format) whereas the former does not. Allowing for integer differences over 1,000 data points there were about 30 that differed by 0.00000000000003, in Number format, and a further 10 or so by much smaller amounts.
The last data point (09:45 AM on day 10) was one of those exhibiting the larger difference (though not as the accumulation of a series of smaller differences). Any difference can be enough for a failure to make an exact match but in seconds that is a difference of about 0.000000002592 by my reckoning, say ~0.0000026 milliseconds or ~26 nanoseconds.
Since in my opinion the day (integer part) is likely to be useful, I would recommend series fill by entering 0 in one cell and 00:15:00 in the next, the dragging down to suit. This has no performance impact because the cell contents are values rather than formulae. For the last entry this gives rise to a difference of 0.00000000000005, ie about twice as much as above, and in some cases as much as 0.00000000000009, about 78 nanoseconds.
With rounding to the second there are differences of a similar order of magnitude. However, a comparison on the last series fill result, with rounding to the second, with the last result from =MROUND(TIME(0, ROW(1:1)*15,0)+A$2, TIME(0, 0, 1)) using EXACT, returns “TRUE”.
Series fill of an entire column took me about 3 seconds. Then rounding to one second with a formula in another column about 12 seconds.
I am trying to deduct time in excel.
There are 2 cells and I'm trying to do = with cell1 coordinates - cell2 coordinates.
This is working fine in most of the sheet with the cells formatted as custom hh:mm
In these particular cells I'm getting ########### rather than the answer
Upon looking further in to why this is happening one of the cells in the calculation is simply showing the time whilst one is showing 07/01/1900 00:57:30 in the top bar. The cell is also formatted to HH:MM so why does it show a date in the bar at the top rather than just the time??
I believe I'm getting the ##### error because on the cell it looks like the above and the other just shows the time as
04:42
How do I stop the first cell from looking like a date plus time in the formula bar?
If the cell with 07/01/1900 00:53:30 is supposed to be a time then you should consider it as indicating 7 days offset in time (assuming that format is dd/mm/yyyy). I get the same results if the cell number is 7.039930556, and I format it for HH:MM.
However that number was generated, it has an offset of 7 days (suspiciously one week!). I suggest looking at how it was generated, it might be due to a wrap around issue.
If you really just want the time value and don't care why there is an integer offset, you can use the function MOD MOD( A1, 1) will return only the fractional amount of the number, which represents the fractional amount in a day, which is the time.
Excel time and date is representing in days since Jan 1st, 1900. 0.5 is 12 hours. 0.1 is 2.4 hours.