Hopefully this is a better phrased question... Ultimately what I'm trying to do is figure out if someone is late or not. So I have their shift start times... it's in a string format of XXX-####, e.i. Sun-0320. I also have a timestamp(Macro) of when they clocked in same format as Now()
So currently I have it as
A1 = Now()
B1 = Right(F1,4)
F1 = ShiftCode
C1 = A1-B1
A1 and B1 are both formatted to custom time of hh:mm
C1 is formatted as numbers. i tried time also
The NOW() function returns both the date and time, which changes as your cell/worksheet/workbook is being updated.
https://support.microsoft.com/en-us/office/now-function-3337fd29-145a-4347-b2e6-20c904739c46
There is a lot of options to add or subtract the time in excel, like here:
https://superuser.com/questions/89045/how-to-get-time-difference-as-minutes-in-excel
https://support.microsoft.com/en-us/office/calculate-the-difference-between-two-times-e1c78778-749b-49a3-b13e-737715505ff6
https://www.ablebits.com/office-addins-blog/2015/06/24/calculate-time-excel/
https://www.excel-easy.com/examples/time-difference.html
https://exceljet.net/formula/calculate-number-of-hours-between-two-times
but regarding your case I would rather use something like this:
instead of
=NOW()
expand the formula, by adding another TEXT function and defining the time units for it:
=TEXT(NOW(),"hh:mm:ss")
Then if you have another cell with a time value, you can easily add or subtract from the cell defined by the aforementioned formula.
Related
I have set of data, trying put a if formula for date range (ref attached image)
Could it be that the second half of the formula isn't absolute:
=IF(P3<$R$1>$S$1,O3-1,IF(P3>U1<V1,O3))
Also, as BigBen said, you will need to use the AND function. Try this:
=IF(AND($R$1<P3,P3<$S$1),O3-1,IF(AND($U$1<P3,P3<$V$1),O3))
See this image:
I also note that you do not have anything entered if the second expression is false.
Say if you wish this to be O3 + 1 (i.e. the next day) then the formula should be this:
=IF(AND($R$1<P3,P3<$S$1),O3-1,IF(AND($U$1<P3,P3<$V$1),O3,O3+1))
I would also like to note that Excel is 24-hour format, so the above parameter of 11:59:59 is 11:59:59am, not 11:59:59pm, which would be 23:59:59.
Hope this helps!
I have cell value with 115y300d which needs to be move to separate cell, however in few cell I have data like 10h30m, so it's mixed text.
What I want to do is value before "y" should go in Year Column "d" in Days, similar for h = hours and M in Minutes. Since it is not in similar format, I'm not able to do text to columns and other functions, and need your help.
You could use find() to do things like so:
=if(iferror(find("y",A2,1)>0,0),left(A2,find("y",A2,1)-1,"")
which will put the value before y into the cell or set it to blank.
Expand the idea to find d & y etc
One option could be:
Formula in B1:
=DROP(WRAPROWS(TEXTSPLIT(CONCAT(BYROW(A1:A5,LAMBDA(a,IF(RIGHT(a)="d",a&"hm","yd"&a)))),,{"y","d","h","m"},,""),4),-1)
If you hit CONCAT() limits, you can also do this by row (dragging):
=TEXTSPLIT(IF(RIGHT(A1)="d",A1&"hm","yd"&A1),{"y","d","h","m"},,,"")
I'm trying to add (Formate) m/d h:mm, with =TODAY() in R26, with
(Formate) d h:mm in S26......
Formula '=R26+S26' in cell U26
all I get is #VALUE
Purpose: after entering the d h:mm value to S26, I need U26 to give me the m/d h:mm value, which is the format of the cell.
It's to give me the day and time that I need to attend to something that is expiring and needs to be renewed/reactivated.
I've tried 'S26=(NOW()+S26); S26=NOW()+S26; S26=NOW()+(S26)
anyone?
Excel time values are decimal numbers. If both cells contain real numbers, not text, then your formula should work. The #Value error shows because at least one of the values is text.
The format of a cell is not important when doing calculations. All that matters is the underlying data type.
Change the cell values to be real numbers (formatted as time).
Short story short:
I want to check the cell C21 if it contains a date. I can't use VB cause it's deactivated by GPO.
Used this from this page
D21 contains this:
=WENN(ISTZAHL(DATWERT(C21));"date";"no date")
in english
=IF(ISNUMBER(DATEVALUE(C21))...
C21 this:
=HEUTE() # in english: =TODAY() Maybe other dates later, but allways in the correct format
but it allways returns "no date"
Use this: =IF(LEFT(CELL("format",C21))="D",..,..). Learn more about CELL formula here.
In your example =TODAY() already a real date and not a date stored as text, so doesn't make too much sense to use DATEVALUE there.
Update
Here are some example dates and how CELL recognize them:
format value output
dd/mmmm/yyyy 12/June/2015 D1
dd/mm/yyyy 12/06/2015 D1
yyyy 2015 G
general 2015 G
dd/mm 12/06 D2
mmmm June G
dd mmmm yyyy 12 June 2015 G
Note: CELL is not volatile, so if the format of source cell is changed it won't be refreshed automatically, you need to either recalculate your sheet / book, either open the formula and press enter (also automatice recalculation initiated by any other volatile formula will cause it to refresh).
Use this formula, the expression will return TRUE if cell A1 contains an invalid date.
=ISERROR(DATE(DAY(A1),MONTH(A1),YEAR(A1)))
This formula works by evaluating each component part of the date: DAY, MONTH and YEAR and then aggregating them using the DATE function.
ISERROR will the catch any errors by returning TRUE (invalid) otherwise FALSE (valid).
Obviously the date value in cell (A1) must contain values >= 01/01/1900.
Useful for "Conditional Formatting".
Excel stores dates as numbers. 1 is 1-Jan-1900.
When it comes to numbers in a cell, Excel cannot tell if a number is meant to be a number or a date.
Today is 11/06/2015 as a date and 42166 as a number. For the consumer of a spreadsheet, the cell can be formatted to display the number as any number format or as a date. Excel formulas cannot tell whether the number in that cell is "meant" to be a date.
So, there is no Excel formula that you can use in a spreadsheet that will tell you if cell A1 is about 42166 widgets or if contains the date of June-11-2015.
Some of provided answers, checks cell format, which will not considers cell value, as you can format differently each cell no matter of its content, for checking if a cell value is date you can use this:
if(ISERROR(VALUE(c21)),"No Date", ----do staff for Date ----)
or shorter version which just will inform you "no date" status. If a date entry is find, it will return its numerical value instead:
IFERROR(VALUE(c21),"No Date")
hope this helps,
Cheers,
M
use the following formula ...
=IF(NOT(ISERROR(DATEVALUE(TEXT(C21,"mm/dd/yyyy")))),"valid date","invalid date")
I think it will solve your problem.
If the value is a string this method would work.
TEXT(DATE(VALUE(RIGHT(AI8,4)),VALUE(MID(TRIM(AI8),4,2)),VALUE(LEFT(AI8,2))),"dd.mm.yyyy") = AI8
Just wanted to add to the discussion that although you can check with a date(year;month;day) it will give you false positives, since the way it works is that it seems to just roll over values that exceed the logical limit, i.e. if you have the date 99-12-35 it will assume that you meant to write Jan 4th 2000, since that is the 35 - the 31 days of December. In other words, you will find some errors, but not all. Same goes for months exceeding 12.
try this formula (depends on date format):
=IF(DATE(TEXT(C21;"yyyy");TEXT(C21;"mm");TEXT(C21;"dd"));"contains date";"doesn't")
I tried every solution posted but none of them work if there are empty cells in the date cells, so I added a check to GBGOLC's answer and now it works with empty cells:
=IF(NOT(OR(ISBLANK(C21),ISERR(DATE(DAY(C21),MONTH(C21),YEAR(C21))))),"Yes it is a date","Not a date")
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.