I have Excel data as per the below screenshots. I am trying to find whether it is "Out Hours" or " Business Hours" based on the start time and close time.
If time is between the start and close time, it should return "Business Hours" else " Out Of Hours".
=IF(B4=MEDIAN(B2,C2,B4),"Business Hours","Out Of Hours")
Here is a massive article about dealing with time -
https://www.ablebits.com/office-addins-blog/2015/06/24/calculate-time-excel/.
You will find everything you need.
I have found this working for you:
=IF(AND(HOUR(B4)+MINUTE(B4)/60>=8;HOUR(B4)+MINUTE(B4)/60<=17);"IN";"OUT")
I don't understand why you involve the median into this formula, you can simply do this:
=IF(AND(B4>=B$2;B4<=C$2);"BUSINESS HOURS";"OUTSIDE HOURS")
Simply said: if B4 lies between B$2 and C$2, then it's "BUSINESS HOURS", else it's outside. I'm using dollarsigns for absolute cell referencing (if you drag your formula to the next row, the value $2 doesn't change).
Related
I am trying to get the averages of a column that meet certain criteria into a single cell.
The following formula works: =AVERAGEIFS(tblData[Sys],tblData[Time],">=12:00 PM",tblData[Time],"<6:00 PM") but when I adjust the time values to: =AVERAGEIFS(tblData[Sys],tblData[Time],">=6:00 PM",tblData[Time],"<4:00 AM") I get an error. I'm guessing it's because the time range goes into the next day.
Is there a better function to use or a workaround?
This formula seems to work for you scenario. It checks for the possibility that the end time is before the start time (but on the next day) and changes the logic accordingly:
=AVERAGE(
IF(
IF(tmStart>=tmEnd,
(tblData[Time]>=tmStart)+(tblData[Time]<=tmEnd),
(tblData[Time]>=tmStart)*(tblData[Time]<=tmEnd))
=1,tblData[Sys],""))
It's important to understand this function does, and the underlying intentions are - I elaborate in the what follows, proffer a workable solution, provide a reconciliation, as well as a link to the workbook with screenshot below.
You will need to specify # days spanned - even the scenario that 'worked' for you (i.e.. =AVERAGEIFS(tblData[Sys],tblData[Time],">=12:00 PM",tblData[Time],"<6:00 PM") could, in theory, span 2 (or more) days. The fact that this 'works' (doesn't return #DIV/0!) is that the 'intersection' of conditions is an non-empty set (i.e. {12pm-5pm}).
As I say, if this was intended to be ">=12:00" from day 1 through to "<6pm" the following, there is no way of determining whether this is indeed the case by simply 'comparing the times' (e.g. 12pmvs 6pm).
Screenshot/here refer::
=IF($I$5="Y",(SUM(1*($C$5:$C$28*(($D$5:$D$28>=$J$3)+1*($D$5:$D$28<$K$3)))))/SUM((($D$5:$D$28>=$J$3)+1*($D$5:$D$28<$K$3))),IFERROR(AVERAGEIFS(C5:C28,D5:D28,">="&J3,D5:D28,"<"&K3),"times don't intersect! "))
where: I5 = 'Y' or 'N' (i.e. multiple days'). When scenario B is selected, with multiple days = 'Y', outcome = 12.9 which reconciles to a manual calculation.
I have a spread sheet in which I want to display some data
Budget 9792.88 --this is b16
Actual cost 10075.75 --this is b17
I want to create a formula in which if our actual cost is 15% over the budget or larger is displays over budgeted. If it is 15% under budget or larger it displays under budget. And if it is in between those two it displays you stayed within your budget.
I have a working formula but I am getting a value error.
=IF(B17<=(B16*1.15),"Met our 15% goal",IF(B17>=(B16/1.15),"Over the budget")),IF(AND(B17<=(B16*1.15),B17>=(B16/1.15)),"Met your goal")
Excel actually reads the if function from the left like we read a book from left, so there is no need to give in between explanation to if function. Once you assign a value to a position, it will not change by its consecutive value.
=IF(A2<A1*0.85,"Under Budget",IF(A2<A1*1.15,"between budget","above budget"))
How about this?
=IF(B17/B16 >= 1.15, "Over budget",IF(B17/B16<=0.85, "Under budget","Met your goal"))
Would you like it to be a little fancy, perhaps?
=INDEX({"under","within","over"},MATCH(B17/B16,{0,0.85,1.15001},1)) & " budget"
NB. The 1.150001 in the array ensures that exactly 15% overrun is still considered "within budget", as is exactly 0.85.
This worked:
=IF(B17>=B16*1.15,"Over the budget",IF(B17<=B16*0.85,"Under the budget","Met your goal"))
Date in = when order comes in
Due Out = "Date in"+ 14 days
Today= "today's date" to determine "Current Status" where i have put IF formula:
IF(Due out<Today,"Over Due,"Current")
Over Due Days= =IF(Current Statues="current","0",Today-Due Out)
Actual Out= Date when order went out/completed
i am stuck at:
Once the order is completed, Is it possible to replace "Over Due Days" (which is showing days overdue based on today's date) with "Actual Out"- "Due Out" ( to show the total delayed days which is the final status).
not sure if have explained it correctly, your help will be much appreciated - this is more related to how to put logic.
Would be easier with actual cells references, but try this in Over Due Days cells:
=If(IsNumber('Actual out'),('Actual Out'-'Due Out'),IF(Current Status="current","0",Today-Due Out))
This checks if there is a number in your Actual Out cells and if not uses the if statement you already had working for you.
You could use Data Validation to ensure only Dates are entered in your Actual Out.
I dont know if I get you right but i think this might be a solution:
=IF(ISBLANK('Actual Out');TODAY()-'Date In';'Actual Out'-'Date In')
This formula calculates the "Over Due Days" with the current as long as the order isnĀ“t completed and calculates the "Actual Over Due" as soon as the order is completed.
It uses the 'ISBLANK' function to check if there already is a date when the order was completed.
Based on the Result the formular calculates with either the current date or the date that was insertet.
Hope I could help.
From what I understood from your question, I have came out with the below. Check and let me know if this is what you are looking for. Actually, you can remove the row "Over Due Days", as it is shown in the row "Current Status"
I have two data sources one is forecast hours for a job the other is actual hours, currently I have this formula to automatically change between the two data sets:-
=IF(K2<='Raw Data'!$A$1,'[Actual Hours.xlsx]Actual Time & Cost - All Suffix'!I84,'Raw Data'!B3))
Though currently it shows no value for the current month (i.e July) I have tried the following but with no success:-
=IF(K2='Raw Data'!$A$1,'Raw Data'!B3,IF(K2<='Raw Data'!$A$1,'[Waterside Forcast Hours.xlsx]Actual Time & Cost - All Suffix'!I84,'Raw Data'!B3))
Any help would be appreciated.
The logic of the second sample formula can be described in these three hierarchical steps.
If K2 is equal to A1 on 'Raw Data' then use 'Raw Data'!B3
If K2 is less than or equal to A1 on 'Raw Data' then use the external 'Actual Time & Cost - All Suffix'!I84
In all other cases, use 'Raw Data'!B3.
It seems like that can be pared down to two steps.
If K2 is less than A1 on 'Raw Data' then use the external 'Actual Time & Cost - All Suffix'!I84
In all other cases, use 'Raw Data'!B3.
The chopped down formula closely resembles the first with the exception of changing <= to <.
=IF(K2<'Raw Data'!$A$1,'[Waterside Forcast Hours.xlsx]Actual Time & Cost - All Suffix'!I84, 'Raw Data'!B3)
Perhaps you are trying to compare to the month and year (or the first/last of the current month).
Thanks to #Jeeped for his advise on this problem. Here is the formula which I finally used which solves the problem:-
=IF(MONTH($K$2)<MONTH('Raw Data'!$A$1),'[Actual Hours.xlsx]Actual Time & Cost - All Suffix'!I84,'Raw Data'!B3)
Feel free to give feedback.
Cheers
I have a little problem with Excel. I nead to make a function that checks if a person is older that 19.
I checked for a function online but it does not work the way it should.
First I have a date in a unusual format 14 10 2012 , I used =SUBSTITUTE(J2, " ", ".")
to get 14.10.2012
after that I use a formula
=IF(P2<DATE(DAY(NOW()),MONTH(NOW()),YEAR(NOW())),"Older than
19","Too young")
but no mater what I do it does not work correctly. It shows the same resolute if the number is bigger or smaller
why is =DATE(DAY(TODAY()),MONTH(TODAY()),YEAR(TODAY())) showing me 3.4.1920 ?
I think that you might have the parameters around the wrong way. If I put:
=DATE(DAY(TODAY()),MONTH(TODAY()),YEAR(TODAY()))
into Excel, I also get 3.4.1920.
If, however, I enter:
=DATE(YEAR(TODAY()),MONTH(TODAY()),DAY(TODAY()))
I get 14.10.2012 - today's date!
======
Just as a followup, I suspect that you are trying to compare today's date with a date of birth to determine someone's age and whether they are over 19?
Try this:
Enter the formula above into a cell (hidden if you like) - lets call it A1
Have the person's date of birth entered into another cell - lets say A2
Enter the formula =A1-A2 into a third cell (A3). This gives you their age in days.
Another formula - this time =A3/365.25 (that is, their age in days divided by the number of days in a year). Let's say that's A4
It's then a simple IF statement =IF(A4>19,"Over 19","Too young")
Hope that helps :-)
=IF(YEAR(NOW())-RIGHT(J2,4)>55,"starejsi",IF(YEAR(NOW())-RIGHT(J2,4)=55,
IF(MONTH(NOW())-LEFT(RIGHT(J2,7),2)>0,"older",
IF(MONTH(NOW())-LEFT(RIGHT(J2,7),2)=0,
IF(DAY(NOW())-LEFT(J2,FIND(" ",J2,1))>=0,"older","younger"),"younger")),"younger"))
finally i have done it. this is the code