Forum Discussion

Ayudame1's avatar
Ayudame1
Copper Contributor
Sep 14, 2023

Excel Formula Help

I Need an excel formula to get total time spent in an account based on date, user, account number.

 

example below of my table data

 

timeAccountUserDate
2:13 PM123A7

8/1/23

2:13 PM123A7

8/1/23

3:13 PM123A78/1/23
1:00 AM456A18/5/23
1:52 AM456A18/5/23
7:32 AM123A48/9/23
7:35 AM123A48/9/23
12:21 PM123A48/9/23

 

 

 

 

 

3 Replies

  • Ayudame1 

    =VSTACK({"Account"."User"."Date"."Total time"},HSTACK(UNIQUE(B2:D9),DROP(REDUCE("",SEQUENCE(ROWS(UNIQUE(B2:D9))),LAMBDA(u,v,VSTACK(u,TAKE(FILTER(A2:A9,BYROW(B2:D9=INDEX(UNIQUE(B2:D9),v,),LAMBDA(x,AND(UNIQUE(TOCOL(x))=TRUE,COUNTA(UNIQUE(TOCOL(x)))=1)))),-1)-TAKE(FILTER(A2:A9,BYROW(B2:D9=INDEX(UNIQUE(B2:D9),v,),LAMBDA(x,AND(UNIQUE(TOCOL(x))=TRUE,COUNTA(UNIQUE(TOCOL(x)))=1)))),1)))),1)))

     

    With Office 365 or Excel for the web you can apply this formula.

     

    =INDEX($A$2:$A$9,LARGE(IF(($B$2:$B$9=B2)*($C$2:$C$9=C2)*($D$2:$D$9=D2),ROW($A$1:$A$8)),1))-INDEX($A$2:$A$9,SMALL(IF(($B$2:$B$9=B2)*($C$2:$C$9=C2)*($D$2:$D$9=D2),ROW($A$1:$A$8)),1))

     

    An alternative for other versions of Excel could be this formula. Enter the formula with ctrl+shift+enter if you don't work with Office 365 or Excel for the web or Excel 2021. This formula is in cell E2 and copied down.

  • NikolinoDE's avatar
    NikolinoDE
    Platinum Contributor
    In the "Time" column, is this the beginning of time? If so, where does the time end?
    If it is the total time, why is it marked PM and AM?
    • Ayudame1's avatar
      Ayudame1
      Copper Contributor

      NikolinoDE the issue with the data report is it pulls start and end time in that one column under time.

       

      I have been trying to figure out how to get the end time in another column quickly because of data can have have multiple times listed and the actual report I have is massive and would take forever to do it manually.

Resources