# meal allowance

#### Manolocs

##### Active Member
Hi, Little bit workload but I need to figure out a calculation for this meal allowances with formulas:
A truck company pays their drivers a meal allowance but only when they are not driving and out of the base, the allowances are:
1- Breakfast 20USD from 7:30 to 9:30
2- Lunch = 40 USD from 12:30 to 14:30
3- Dinner = 50 USD from 19:30 to 21:30
For example, the truck start the journey 5:00 on the 2nd August, arrived in the first layover at 19:30 on the same day the driver is entitled to Dinner only, on the 3rd AUG the driver stay all day in this city resting so the driver is entitled to breakfast, lunch, and dinner, on the 4th AUG the journey starts at 04:00. The journey last until 14:35 only Dinner will be paid because the driver arrived 14:35 and miss by 5 minutes the lunch allowance.
The company only pays the meals if the drivers are out of the home base and not are driving at the time.

Any help is more than welcome.

### Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney

#### goesr

##### Well-known Member
 A1 B C D E F G H I J K L M N 2 Date Away Driving at Breakfast Driving at Lunch Driving at Dinner Breakfast Lunch Dinner Total Driving Start Driving Stop 3 8/1/17 x 20 40 50 110 None None 4 8/2/17 x x x 20 20 5:00 7:00 5 8/3/17 x x x x 0 5:00 20:00

<colgroup><col><col><col><col><col><col><col><col><col><col><col span="3"><col></colgroup><tbody>
</tbody>

#### goesr

##### Well-known Member
Hello Manolocs - I hope this will help you get started.

The equation I used in H3 is: =IF(AND(\$C3="x",D3<>"x"),20,"")

#### goesr

##### Well-known Member
The equation in I3 is: =IF(AND(\$C3="x",E3<>"x"),40,"")
The equation in J3 is: =IF(AND(\$C3="x",F3<>"x"),50,"")

Let me know if you do not understand what I'm trying to do here.

#### goesr

##### Well-known Member
The driver would then have to fill in an x in columns C, D, E, and F as appropriate. If they are away - put an x in column c, if driving at breakfast, put an x in column d and so forth.

#### Manolocs

##### Active Member
Hi goesr, Thanks for your time but the idea is to get this "x" from the times the driver is working and not to make it all manually. there is a Start time and End time and then the spreadsheet should calculate.

Threads
1,102,783
Messages
5,488,855
Members
407,658
Latest member
Arias610

### This Week's Hot Topics

• Timer in VBA - Stop, Start, Pause and Reset
[CODE=vba][/CODE] Option Explicit Dim CmdStop As Boolean Dim Paused As Boolean Dim Start Dim TimerValue As Date Dim pausedTime As Date Sub...
• how to updates multiple rows in muliselect listbox
Hello everyone. I need help with below code. code is only chaning 1st row in mulitiselect list box. i know issue with code...
• Delete Row from Table
I am trying to delete a row from a table using VBA using a named range to find what I need to delete. My Range is finding the right cell. In the...
• Assigning to a variable
I have a for each block where I want to assign the value in column 5 of the found row to the variable Serv. [CODE=vba] For Each ws In...
• Way to verify information
Hi All, I don't know what to call this formula, and therefore can't search. I have a spreadsheet with information I want to reference...
• Active Cell Address – Inactive Sheet
How to use VBA to get the cell address of the active cell in an inactive worksheet and then place that cell address in a location on the current...