# How do I subtract?

Hi Gays , I need your help

I have the total number of hours worked which is “40:00:00” and I have the number of hours worked for each employee.
How do I subtract the employee’s hours worked from the total hours worked?
Then I check whether the number of hours worked by the employee is equal to the number of hours worked or less

Thanks

per week ?
and total number of hours always 40 ?

Yes Per Week and always 40

@NA_AN

Assign totalHoursWorkedString = “40:00:00”
Assign employeeHoursWorkedString = “35:30:00”

Assign totalHoursWorked = TimeSpan.Parse(totalHoursWorkedString)
Assign employeeHoursWorked = TimeSpan.Parse(employeeHoursWorkedString)

Assign remainingHours = totalHoursWorked - employeeHoursWorked

Assign isEqualOrLess = remainingHours <= totalHoursWorked

1 Like

Hi @NA_AN

``````totalHours = TimeSpan.Parse("40:00:00")

For Each hour in employeeHoursList:
hourDiff = totalHours - TimeSpan.Parse(hour)
if (TimeSpan.Parse(hour) <= totalHours):
Then "Continue next process"
``````
1 Like

Hi @NA_AN

Please refer the below workflow for the above requirement.

Sequence1.xaml (8.6 KB)

Regards,

1 Like

@NA_AN
(subtraction , NumOfHoursWorked ,totalNumOfworked) type : timeSpan
edit the condition to
subtraction<TimeSpan.Parse(“00:00:00”)
or to
NumOfHoursWorked < totalNumOfworked

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.