How to show IDs which are in ready status within certain time range - frontend

I'm pretty new Qlik Sense user, and I'm making pivot table which shows those patients who have been in ready status between selected time range. I have columns OWNER_ID, START_TIME, END_TIME & STATUS. START_TIME & END_TIME are in hours, for example, 6 which means 6 o'clock.
OWNER_ID
column contains those patients who have "ready status".
For now my time selection is made with filter pane and you can select "0-2 o'clock", 3-5 o'clock", "6-8 o'clock" et cetera. When I select a time range, for example 6-8 o'clock, pivot table shows those patients whose start time is 6, 7 or 8, but it should show those who have been in ready status between 6 and 8 o'clock.
I have tried aggr() chart function like
=aggr(max({1<END_TIME={">=$(=min(EHour))"}>} END_TIME),END-TIME)
within Data -> Dimensions -> END_TIME -> Field, but that doesn't work - pivot table shows OWNER_IDs whose END_TIME is greater than given time range.
How to solve this?

Seems to me if you had a data table that looked like this:
OWNER_ID
START_TIME
END_TIME
STATUS
001
05:00
10:00
Ready
002
09:00
13:00
Not Ready
003
21:00
00:00
Not Ready
004
10:00
11:00
Ready
005
09:00
12:00
Ready
...and then a table with the hours information:
START_TIME
ETIME
EHOUR
00:00
01:00
0-2 o'clock
01:00
02:00
0-2 o'clock
02:00
03:00
0-2 o'clock
03:00
04:00
3-5 o'clock
04:00
05:00
3-5 o'clock
05:00
06:00
3-5 o'clock
06:00
07:00
6-8 o'clock
07:00
08:00
6-8 o'clock
08:00
09:00
6-8 o'clock
09:00
10:00
9-11 o'clock
10:00
11:00
9-11 o'clock
11:00
12:00
9-11 o'clock
12:00
13:00
12-14 o'clock
13:00
14:00
12-14 o'clock
14:00
15:00
12-14 o'clock
15:00
16:00
15-17 o'clock
16:00
17:00
15-17 o'clock
17:00
18:00
15-17 o'clock
18:00
19:00
18-20 o'clock
19:00
20:00
18-20 o'clock
20:00
21:00
18-20 o'clock
21:00
22:00
21-23 o'clock
22:00
23:00
21-23 o'clock
23:00
00:00
21-23 o'clock
...then you'd have an association between [START_TIME] and [EHOUR], such when you select [EHOUR], it correctly filters your data by the [START_TIME]. Then, you only have to adjust your Set Expression, which I think should look more like this:
Only({<STATUS={'Ready'}>} STATUS)
Here's a screenshot GIF of how it looks for me:
Hopefully I understood that correctly!

Related

How to sum values in Excel that occur between 2 hours

I would like to sum the sales depending on the time diapasons of the day-night in which they occur. For example, I would like to sum all sales that happened between 22:00h and 2:00h.
Hour Sales
18:58 49
18:00 49.5
03:01 31
20:00 139
09:15 61.5
11:36 5
08:00 24
16:32 25
12:30 96.5
17:30 75.5
09:00 80
00:10 24
15:00 24
18:00 216
09:30 24
06:30 47.5
So if I try to do a sumifs where the hour is >=22:00 and <23:00, the formula works. However, if I try to sumifs the values between 22:00 and 2:00, in other words the first criteria is ">=22:00" and the second is "<2:00", the sumifs cannot work. I do understand why but I'm struggling to find an alternative way to solve this task.
As stated, we need to add 1 when it rolls to the next day, which means SUMPRODUCT:
=SUMPRODUCT($B$2:$B$17,((E2<D2)+$A$2:$A$17>=D2)*(($A$2:$A$17<D2)+$A$2:$A$17<(E2<D2)+E2))

formula to calculate work hours and sort by employee in an overlapping data array

I have a .XLXS table with worker names, start times, and end times. I want to show the total hours worked by worker while ignoring overlapping periods.
For example if "Bob" works from 0800 to 1400 and also works from 0900 to 1300 his total time for that day should be 6 hours. If "Joe" works 0700 to 0900 his time for that day is 2 hours.
The number of workers varies and six months of data is about 2100 rows.
The formula provided by "barry houdini" to "Formula that will calculate total hours in overlapping date array" works for one worker but I don't know enough about Excel to make it sort for multiple workers.
=SUMPRODUCT((COUNTIFS(B:B,"<"&MIN(B:B)+ROW(INDIRECT("1:"&ROUND((MAX(C:C)-MIN(B:B))*1440,0)))/1440-1/2880,C:C,">"&MIN(B:B)+ROW(INDIRECT("1:"&ROUND((MAX(C:C)-MIN(B:B))*1440,0)))/1440-1/2880)>0)+0)/60
MOD_BY START_DATETIME END_DATETIME total time
bob 1/2/19 17:30 1/2/19 18:45 3.2500
bob 1/2/19 21:00 1/2/19 21:15
bob 1/2/19 21:00 1/2/19 22:00
bob 1/2/19 15:00 1/2/2019 16:00
joe 1/2/19 17:30 1/2/19 18:45
joe 1/2/19 21:00 1/2/19 21:15
joe 1/2/19 21:00 1/2/19 22:00
joe 1/2/19 15:00 1/2/2019 16:00
My objective is to have an output of total hours worked by worker. The formula as provided gives a total for the entire file without breaking it down by worker.
You will need MAXIFS and MINIFS which means you need Office 365 Excel:
=SUMPRODUCT(--(COUNTIFS(A:A,"bob",B:B,"<=" & MINIFS(B:B,A:A,"bob") + ROW($XFD$1:INDEX($XFD:$XFD,ROUND((MAXIFS(C:C,A:A,"bob")-MINIFS(B:B,A:A,"bob"))*1440,0)))/1440-1/2880,C:C,">=" & MINIFS(B:B,A:A,"bob") + ROW($XFD$1:INDEX($XFD:$XFD,ROUND((MAXIFS(C:C,A:A,"bob")-MINIFS(B:B,A:A,"bob"))*1440,0)))/1440-1/2880)>0))/60

Excel Find this Value and this Value and where they meet enter the new value

Hi Guys I know I should know this but I am haveing a brain freeze!
So in sheet1 I have a list of people and each coloumn = a date
Emp No. Rota 01/04/2018 02/04/2018 03/04/2018 04/04/2018 05/04/2018 06/04/2018 07/04/2018 08/04/2018 09/04/2018 10/04/2018 11/04/2018 12/04/2018 13/04/2018 14/04/2018 15/04/2018 16/04/2018 17/04/2018 18/04/2018 19/04/2018 20/04/2018 21/04/2018 22/04/2018
10087248 1
10111378 1
10104720 1
10103818 1
10128761 1
10109686 1
10110853 1
10123778 1
10105003 1
10115410 1
10109674 1
10117543 1
10114185 1
10105990 1
10114457 1
10087185 1
10121055 1
in sheet 2 I have a list of dates and then each coloumn = a team
Date 1 2 3 4 5 7A 7B R1 E1
Mon 01/01/2018 06:00 14:00 14:00 06:00 14:00 18:00 18:00 08:00 14:00
Tue 02/01/2018 06:00 14:00 14:00 06:00 14:00 18:00 18:00 08:00 14:00
Wed 03/01/2018 14:00 14:00 06:00 14:00 18:00 18:00 08:00 14:00
Thu 04/01/2018 06:00 14:00 14:00 06:00 14:00 18:00 18:00 08:00 14:00
Fri 05/01/2018 06:00 14:00 06:00 14:00 14:00 08:00 14:00
Sat 06/01/2018
Sun 07/01/2018 14:00 06:00 18:00
Mon 08/01/2018 14:00 06:00 06:00 14:00 14:00 18:00 18:00 08:00 08:00
Tue 09/01/2018 14:00 06:00 06:00 14:00 14:00 18:00 18:00 08:00 08:00
Wed 10/01/2018 14:00 06:00 14:00 14:00 18:00 18:00 08:00 08:00
Thu 11/01/2018 14:00 06:00 06:00 14:00 14:00 18:00 18:00 08:00 08:00
Fri 12/01/2018 06:00 06:00 14:00 14:00 14:00 08:00 08:00
Sat 13/01/2018
Sun 14/01/2018 14:00 06:00 18:00
Mon 15/01/2018 06:00 14:00 14:00 06:00 14:00 18:00 18:00 08:00 14:00
Tue 16/01/2018 06:00 14:00 14:00 06:00 14:00 18:00 18:00 08:00 14:00
I want to be able to see when the person is due to start in sheet 1.
I am trying to use index match but cant get it to work.
You need some common denominator in your data sheet.
That means, in both Table1 and Table2 you need a column to contain the same data which will act as your criteria range.
Then it appears you need to use =VLOOKUP()
Can't really help you further without you editing either your Sheet1 or Sheet2 to have at least 1 column in common,
As of now, you have no way of matching something to a specific number given there are no possible matches (unless I'm missunderstanding what you're trying to achieve)
Ok So I cheated I made the dates match so both start from 01/03/2018 then I fliped the Rota so both tables had the date across the top and then just used =VLOOKUP($B2,Sheet3!$A:$QN,COUNT($C$1:C$1,FALSE))

Excel multiple IF, AND, OR nested statements - with date and time criteria

I need to write an 'if' statement to output either DAY, NIGHT, or WEEKEND based on the day of the week and times as below:
output DAY if the date and time is Monday to Friday 7am to 9pm
output NIGHT if the date and time is Monday to Thursday 9pm to 7am
output WEEKEND if the date and time is Friday 9pm to Monday 7am.
My data comes like this below in half hourly increments :
24/04/2015 16:30
24/04/2015 18:00
24/04/2015 18:30
24/04/2015 20:30
24/04/2015 21:00
24/04/2015 21:30
24/04/2015 23:00
24/04/2015 23:30
25/04/2015 0:00
25/04/2015 0:30
25/04/2015 1:00
25/04/2015 10:00
25/04/2015 11:30
25/04/2015 22:00
25/04/2015 22:30
25/04/2015 23:00
25/04/2015 23:30
26/04/2015 0:00
26/04/2015 0:30
26/04/2015 18:30
26/04/2015 19:00
26/04/2015 19:30
26/04/2015 20:00
26/04/2015 20:30
26/04/2015 21:00
26/04/2015 21:30
26/04/2015 23:00
26/04/2015 23:30
27/04/2015 0:00
27/04/2015 0:30
27/04/2015 1:00
27/04/2015 6:30
27/04/2015 7:00
27/04/2015 7:30
(theres a total of 17,000 rows of half hourly data for an entire year, SO I have altered some of the days and times so that it's easier to work with and there should be some data that matches all 3 of the DAY, NGHT, WEEKEND criteria)
I have studied this solution here https://stackoverflow.com/a/15754238/1602250, and it makes sense but I can't get it to work.
I've output the day of the week into a 2nd column and tried this:
=IF(AND(A2="Fri",A1=">9:00:01 p.m.",A1="<7:00:01 a.m."),"WEEKEND") - but this needs to say between Fri9pm and Mon7am.
I've also tried this one, doesn't work either.
=IF(OR(A2="Mon",A2="Tue",A2="Wed",A2="Thu",A2="Fri"),IF(A1=">7:00:00 a.m.", A1="<9:00:00 p.m.", "DAY", IF(AND(OR(A2="Sat",A2="Sun", "WEEKEND")))
Please can someone help, I'm going half crazy...
I suppose your data in column A, and datatype is text.
So I'll get date/time.
Column B: Get date: =DATE(MID(A2,7,4),MID(A2,4,2),LEFT(A2,2))
Column C: Get time: =RIGHT(A2,LEN(A2)-11)
Column D: Do req: =IF(AND(WEEKDAY(B2)>=2,WEEKDAY(B2)<=6,TIMEVALUE(C2)>=TIMEVALUE(TEXT("7:00","HH:mm")),TIMEVALUE(C2)<TIMEVALUE(TEXT("21:00","HH:mm"))),"DAY",IF(AND(WEEKDAY(B2)>=2,WEEKDAY(B2)<=5,OR(TIMEVALUE(C2)>TIMEVALUE(TEXT("7:00","HH:mm")),TIMEVALUE(C2)>=TIMEVALUE(TEXT("21:00","HH:mm")))),"NIGHT","WEEKEND"))
please see attachment. Hope this help.

Excel if isnumber search

updating picture solved issue
I'm trying to check cell IF contains a string "Friday" AND the hour is bigger/later then 17:00 THEN multiply the hour rate by 1.5
I'm using this func:
=IF(ISNUMBER(SEARCH("Saturday",$A$3:$A$33)),$C$40*((C45-B45)*24)*1.5,IF(ISNUMBER(SEARCH("Friday",$A$3:$A$33)),IF("Friday",A42:A71,IF(TIME(17,0,0),$C$40*((C45-B45)*24)*1.5,$C$40*((C45-B45)*24)))))
in short explain is: Everything multyply by $C$40 (25$) except of Friday after 17:00 that its multiply $C$40 *1.5
But it's not working for me. Can somebody help?
NAME HOUR RATE $
DATE dany 25 TOTAL PAY/DAY
start work at.. worked until..
Sunday 07:30 16:00 212.50
Monday 07:30 16:00 212.50
Tuesday 07:30 16:00 212.50
Wednesday 15:01 16:00 24.58
Thursday 07:00 16:00 225.00
Friday 17:01 23:30 162.08
Saturday 17:30 22:00 112.50
Sunday 07:30 16:00 212.50
Monday 07:30 16:00 212.50
Tuesday 07:30 16:00 212.50
Wednesday 08:00 15:00 175.00
Thursday 07:30 16:00 212.50
Friday 07:30 16:00 212.50
Saturday 18:00 22:45 118.75
Sunday 07:30 16:00 212.50
Monday 07:30 16:00 212.50
Tuesday 07:30 16:00 212.50
Wednesday 07:30 16:00 212.50
Thursday 07:30 16:00 212.50
Friday 07:30 16:00 212.50
Saturday 07:30 16:00 212.50
Sunday 07:30 16:00 212.50
Monday 07:30 16:00 212.50
Tuesday 07:30 16:00 212.50
Wednesday 07:30 16:00 212.50
Thursday 07:30 16:00 212.50
Friday 07:30 16:00 212.50
Saturday 07:30 16:00 212.50
Sunday 07:30 16:00 212.50
Monday 07:30 16:00 212.50
TOTAL HOURES 236.72
TOTAL SALERY 5,917.92
OK, Try this:
=IF(A42="Friday",IF(C42-TIMEVALUE("17:00")<0,(((C42-B42)*24)*$C$40),IF(TIMEVALUE("17:00")-B42<0,(((C42-B42)*24)*$C$40)*1.5,(((C42-B42)-(C42-TIMEVALUE("17:00")))*24)*$C$40+((C42-TIMEVALUE("17:00"))*24)*$C$40*1.5)),IF(A42="Saturday",(((C42-B42)*24)*$C$40)*1.5,(((C42-B42)*24)*$C$40)))
It looks like your data is starting in row 42.
The formula first checks to see if the day is Friday, if it is not then it checks for Saturday . If it is Saturday it does the time and a half calculation. If not Saturday then it must be one of the other days and does the straight time calculation.
Most of this formula is concerned with figuring out when the person worked on Friday. I think it would be a good idea if you can add extra columns to your spreadsheet to do some of the Friday calculations there. For example add a column that show total hours worked that day, and another column that shows the overtime hours for that day.
=IF(ISNUMBER(SEARCH("Friday",$A$4:$A$11)),IF(C4-$E$2<0,(((C4-B4)24)$C$2),IF($E$2-B4<0,(((C4-B4)24)$C$2)*1.5,(((C4-B4)-(C4-$E$2))24)$C$2+((C4-$E$2)24)$C$2*1.5)),IF(ISNUMBER(FIND("Saturday",$A$4:$A$11)),((C4-B4)24)$C$2*1.5,((C4-B4)24)$C$2))
chack image

Resources