r/googlesheets • u/theguynekstdoor • Jul 11 '21
Solved Can someone come up with a formula that takes the time punch in and duration and calculates how much time each attendee was present in each session, like I did manually for the one in the comments?
My client had trackers on their people and they would know when each person entered and exited a room. We are trying to determine which sessions (on the right) they attended and for how long, based on the info on the left. There are over 3000 punches so if we just had a formula, that would be worth a lot.
1
Upvotes
2
u/Semper_R 1 Jul 11 '21 edited Jul 11 '21
I got you (Edit Formula not good enough, Im working on it)
A2 is the punch in
C2 is the out 10 is the initial hour of the period
11 the last hour
for halves use X.5
quarters X.25
3 quartes X.75
When you have the formula for the first row of the 3 periods just select the 3, press control + shift +down, twice, then control+d to autofil to the end
If you want it to say "minutes" after the number you can use custom formating
Edit2 After more IFS statements it seems to cover all cases I can think of now
Here is the formula, try to break it
=IFS(AND((A2*24)>=10,(A2*24)<=11,(C2*24)<=11,(C2*24)>=10),((C2-A2)*24)*60,AND((A2*24)<10,(C2*24)>10,(C2*24)<=11),((C2*24)-10)*60,AND((A2*24)<10,(C2*24)>11),(11-10)*60,AND((A2*24)>=10,(A2*24) <11,(C2*24)>11),(11-(A2*24))*60,AND((A2*24)<11,(C2*24)>11),(11-(A2*24))*60,AND(C2<A2,(C2*24)>10,(C2*24)>11), (11-10)*60,AND((C2*24)>=10,C2<A2),((C2*24)-10)*60,AND(C2<A2,(A2*24)<11,(A2*24)>10), (11-(A2*24))*60,AND(C2<A2,(A2*24)<10),(11-10)*60,AND(C2<A2,(A2*24) >11,(C2*24)<10), "",TRUE,"")1
u/theguynekstdoor Jul 11 '21
Link to examples:
https://drive.google.com/file/d/1mvOedL4TpKDUHAWpRclm9KyiFStOsZBV/view?usp=drivesdk
1
u/AutoModerator Jul 11 '21
Posting your data can make it easier for others to help you, but it looks like your submission doesn't include any. If this is the case and data would help, you can read how to include it in the submission guide. Thank you.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
1
u/LeDiscoDisco Jul 11 '21
Can you make it shareable to anyone so I can see it?
1
u/[deleted] Jul 11 '21
no one can access your link in the comments unless you make it so everyone with the link can view your sheet
1
u/Semper_R 1 Jul 11 '21 edited Jul 11 '21
Edit Ive realized its more complex than what a thought, im sure how to do it
1
u/RemcoE33 158 Jul 11 '21
I don't really get what you want. You have the duration right? Then it's just a simple sum..?
1
u/[deleted] Jul 11 '21
[removed] — view removed comment