Calculating if Meal Allowance applies based on time out of the office

Jaypee666

New Member
Joined
May 26, 2020
Messages
26
Office Version
  1. 365
  2. 2016
  3. 2010
Platform
  1. Windows
Hi All,

I have what is again probably another one for the Excel gurus on this form, but I am currently about to lob a laptop out a window trying to get this to work.

below should show an example of a sheet currently being used.
Ultimately what I am trying, (in vain) to get to work is if the total time on the road on any given date is over 5 hours that the Meal Allowance in R4 will be applied and if over 10 hours R3 will be applied
For now though I would be happy with getting a simply Yes/No response if applicable or not.

Looking forward to your responses, and thanking you in advance.


Expenses sheet 15.06.23- 28.06.23.xlsx
ABCDEFGHIJKLMNOPQRS
1Company Expenses Claim Form
2
3ALLOWANCE SHEET15th June - 28th June '2339.08more 10 hours
416.29more 5 hours
5EMPLOYEE:-Employee 789665
6
7
8DATEFROMTOREASONRETURN?TIME DEPARTEDTIME ARRIVEDJOB COMPLETERETURN TO OFFICEKMS BAND 1 KMS BAND 2KMS BAND 3KMS BAND 4MILEAGE TOLLSTIME AWAYMEALS
90.51820.90630.39220.2587TOTALALLOWANCEALLOWANCE
10
1120/06/2023OfficeClient 1On-Site IssueY11:50:0012:25:0012:35:0013:25:0058.00No01:35
1221/06/2023OfficeClient 2On-Site IssueY10:30:0011:00:0011:40:0012:10:0058.00No01:40
1321/06/2023OfficeClient 3On-Site IssueY15:25:0016:00:0016:10:0017:00:0058.00No01:35
1428/06/2023OfficeClient 4On-Site IssueN10:55:0011:13:0011:25:0012.00No00:30
1528/06/2023Client 4Client 5On-Site IssueN11:25:0013:15:0014:00:0016.00No02:35
1628/06/2023Client 5Client 6On-Site IssueY14:05:0014:45:0016:00:0017:00:0060.00No02:5516.29
17
18
19
20
Main
Cell Formulas
RangeFormula
P11:P16P11=IF(SUMIFS(Q11:Q26, A11:A26, A11) > TIME(5,0,0), "Yes", "No")
Q11:Q16Q11=IF(I11="", TEXT(MOD((H11-F11+1), 1), "hh:mm"), TEXT(MOD((I11-F11+1), 1), "hh:mm"))
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Sorry for the confusion. I tried something but it did not work. I have removed it. Not sure how to delete my reply.
 
Upvote 0
If you just take the difference between the return to office time and the time departed like this:
Time Away (Q11)
=I11-F11
the Meal Allowance formula like this should work.
=IF(HOUR(Q11)>=5,"Yes","No")
 
Upvote 0
@ldonkers, I should have mentioned, this is a sheet I was asked to take a look at and the formulas in it were what I was given.

I was looking at a simple formula like I11-F11 in Q11 and that would be fine if there was only 1 trip or site visit in the day, but as you can see in the example, on the 28th there were 3 seperate visits, that while individually don't merit a Meal Allowance, combined they do as it was one trip.
 
Upvote 0
I was looking at your data. It looks like the data can be entered as many trips on a single day. This could make the formulas hard to manage. You may want to consider the following approach: Keep you data as is but create another table below that will total by day. You can then have your mileage totals, meal expenses calculated without changing any formulas.

I would add the Time away with the following formula:
=IF(E11="y",I11-F11,H11-F11)

2023-07-01 07_33_27-Book3 - Excel.png

This would take of the return to office issue and you can copy that formula down.

I would create the subtotals table like below.

2023-07-01 07_34_49-Book3 - Excel.png

In the time away you can the use the following to get sum for that day. This will take all the time for a day and total them together.

=SUMIF($A$11:$A$16,A23,$P$11:$P$16)

1688211410252.png

You can then apply the following formula for the meal allowance.

=IF(HOUR(C23)>=5,"Yes","No")


1688211502436.png

You can use the same idea to get the totals for mileage etc.
 
Upvote 1
Solution

Forum statistics

Threads
1,215,200
Messages
6,123,601
Members
449,109
Latest member
Sebas8956

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top