asked on November 6, 2019

I am trying to calculate my total hours for the day on a table in a given row.

 

 

I am using the value of seconds in the day for the calculations.

 

There are two cases, IF Lunch_Out / Lunch_In are empty I just need to calculate (Time_Out - Time_In) for my total hours.  

ELSE calculate (Lunch_Out - Time_In) + (Time_Out - Lunch_In)

 

Here would be my result calculation from this:

=IF(INDEX(tbl_timecard.Lunch_Out_Dropdown, ROW()) = “”, 
SUB(DIV(INDEX(tbl_timecard.Time_Out_Dropdown, ROW()), 3600), DIV(INDEX(tbl_timecard.Time_In_Dropdown, ROW()), 3600))
   , 
ADD(SUB(DIV(INDEX(tbl_timecard.Lunch_Out_DropDown, ROW()), 3600) , DIV(INDEX(tbl_timecard.Time_In_DropDown, ROW()), 3600)), SUB(DIV(INDEX(tbl_timecard.Time_Out_DropDown, ROW()), 3600) , DIV(INDEX(tbl_timecard.Lunch_In_DropDown, ROW()), 3600)))
   )

Just Looking at the one value if empty (Lunch_Out) I would want to do the calculation, (Time_Out - Time_In), and if the value is NOT empty then do the other calculation, (Lunch_Out - Time_In) + (Time_Out - Lunch_In).

 

I am not sure where my logic is missing any pieces.  If a dropdown choice is not selected, is the value truly BLANK?  Wondering if the ... = "" is what is not working correct.  I added the value 0 to see if modifying the logic to the following below would help.  But it did not.

=IF(INDEX(tbl_timecard.Lunch_Out_Dropdown, ROW()) = 0,  ....

NOTE:  If it would work I would most likely modify it to a value that would never exist in the dropdown value choice.  Since 12:00 AM = 0 already.

0 0