Filter Spread sheet by date range and calculate difference between dates

SirSquiddly

New Member
Joined
Jun 26, 2018
Messages
40
Hi

I have a large spread sheet that needs to be analysed at the end of each month. I need some help trying to make this much more efficient.

Currently on hire dates are in a column (R) and off hire dates in the next (S).

R S
[TABLE="width: 251"]
<colgroup><col><col></colgroup><tbody>[TR]
[TD]20/05/2019[/TD]
[TD]06/06/2019[/TD]
[/TR]
[TR]
[TD]20/05/2019[/TD]
[TD]06/06/2019[/TD]
[/TR]
[TR]
[TD]20/05/2019[/TD]
[TD]06/06/2019[/TD]
[/TR]
[TR]
[TD]22/05/2019[/TD]
[TD]08/06/2019[/TD]
[/TR]
[TR]
[TD]02/06/2019[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]24/05/2019[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]28/07/2019[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]28/07/2019[/TD]
[TD]14/07/2019[/TD]
[/TR]
[TR]
[TD]28/07/2019[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]26/06/2019[/TD]
[TD]5/08/2019[/TD]
[/TR]
</tbody>[/TABLE]

So I have to do a monthly report and need to filter out everything from other months and have a total day count as well. Lets use July for example. There are some hire tools that leave in June gone and return in august (bottom example above) or are not yet returned by months end (blank return column) but both would require 31 days for July. Also, there are some tools start date in June and return in July but I would only need to calculate the days for July.

Can anyone suggest an easier way to do this than manually sorting through the dates and adding 01/07/19 to some of the start dates and 31/07/2019 to the off hire dates. There are hundreds of rows each month.

Any help would be hugely appreciated. Thanks
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Two comments first:
- Please use a common date format in your questions as many Shermans use this site. I've changed to dd-mmm-yy format.
- The row "28/07/2019 14/07/2019" flummoxed me as it looks like they left before they started?

Is this the result you might expect? The first two columns are your dates, R2 and S2 and my MAX and MIN checks. The "Days in July" is my calculation. The top row 01-Jul-19 is where you type the first day of the month you're interested in. The 31-Jul-19 is just an =EOMONTH(G1,0) statement to get the last day of that month.

[TABLE="class: grid, width: 666"]
<colgroup><col style="mso-width-source:userset;mso-width-alt:3165;width:68pt" width="91"> <col style="mso-width-source:userset;mso-width-alt:3304;width:71pt" width="95"> <col style="mso-width-source:userset;mso-width-alt:721;width:16pt" width="21"> <col style="mso-width-source:userset;mso-width-alt:3002;width:65pt" width="86"> <col style="mso-width-source:userset;mso-width-alt:2978;width:64pt" width="85"> <col style="mso-width-source:userset;mso-width-alt:3304;width:71pt" width="95"> <col style="mso-width-source:userset;mso-width-alt:2513;width:54pt" width="72"> <col style="mso-width-source:userset;mso-width-alt:2304;width:50pt" width="66"> </colgroup><tbody>[TR]
[TD="width: 91"]R[/TD]
[TD="width: 95"]S[/TD]
[TD="width: 21"][/TD]
[TD="width: 86"]R2[/TD]
[TD="width: 85"]S2[/TD]
[TD="width: 95"]Days in July[/TD]
[TD="width: 72"]01-Jul-19[/TD]
[TD="width: 66"]31-Jul-19[/TD]
[/TR]
[TR]
[TD]20-May-19[/TD]
[TD]06-Jun-19[/TD]
[TD][/TD]
[TD]01-Jul-19[/TD]
[TD]06-Jun-19[/TD]
[TD]0
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]20-May-19[/TD]
[TD]06-Jun-19[/TD]
[TD][/TD]
[TD]01-Jul-19
[/TD]
[TD]06-Jun-19[/TD]
[TD]0[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]20-May-19[/TD]
[TD]06-Jun-19[/TD]
[TD][/TD]
[TD]01-Jul-19[/TD]
[TD]06-Jun-19[/TD]
[TD]0[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]22-May-19[/TD]
[TD]08-Jun-19[/TD]
[TD][/TD]
[TD]01-Jul-19[/TD]
[TD]08-Jun-19[/TD]
[TD]0[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]02-Jun-19[/TD]
[TD] [/TD]
[TD][/TD]
[TD]01-Jul-19[/TD]
[TD]31-Jul-19[/TD]
[TD]31[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]24-May-19[/TD]
[TD] [/TD]
[TD][/TD]
[TD]01-Jul-19[/TD]
[TD]31-Jul-19[/TD]
[TD]31[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]28-Jul-19[/TD]
[TD] [/TD]
[TD][/TD]
[TD]28-Jul-19[/TD]
[TD]31-Jul-19[/TD]
[TD]4[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]28-Jul-19[/TD]
[TD]14-Jul-19[/TD]
[TD][/TD]
[TD]28-Jul-19[/TD]
[TD]14-Jul-19[/TD]
[TD]0[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]28-Jul-19[/TD]
[TD] [/TD]
[TD][/TD]
[TD]28-Jul-19[/TD]
[TD]31-Jul-19[/TD]
[TD]4[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]26-Jun-19[/TD]
[TD]05-Aug-19[/TD]
[TD][/TD]
[TD]01-Jul-19[/TD]
[TD]31-Jul-19[/TD]
[TD]31[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]


As formulae these appear as:
[TABLE="class: grid, width: 726"]
<colgroup><col span="2"><col><col><col><col><col><col></colgroup><tbody>[TR]
[TD]R[/TD]
[TD]S[/TD]
[TD][/TD]
[TD]R2[/TD]
[TD]S2[/TD]
[TD]="Days in "&TEXT(G1,"mmmm")[/TD]
[TD]43647[/TD]
[TD]=EOMONTH(G1,0)[/TD]
[/TR]
[TR]
[TD]43605[/TD]
[TD]43622[/TD]
[TD][/TD]
[TD]=MAX(A2,$G$1)[/TD]
[TD]=MIN(B2,$H$1)[/TD]
[TD]=IF(E2-D2<0,0,E2-D2+1)[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]43605[/TD]
[TD]43622[/TD]
[TD][/TD]
[TD]=MAX(A3,$G$1)[/TD]
[TD]=MIN(B3,$H$1)[/TD]
[TD]=IF(E3-D3<0,0,E3-D3+1)[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]43605[/TD]
[TD]43622[/TD]
[TD][/TD]
[TD]=MAX(A4,$G$1)[/TD]
[TD]=MIN(B4,$H$1)
[/TD]
[TD]=IF(E4-D4<0,0,E4-D4+1)[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]43607[/TD]
[TD]43624[/TD]
[TD][/TD]
[TD]=MAX(A5,$G$1)[/TD]
[TD]=MIN(B5,$H$1)[/TD]
[TD]=IF(E5-D5<0,0,E5-D5+1)[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]43618[/TD]
[TD] [/TD]
[TD][/TD]
[TD]=MAX(A6,$G$1)[/TD]
[TD]=MIN(B6,$H$1)[/TD]
[TD]=IF(E6-D6<0,0,E6-D6+1)[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]43609[/TD]
[TD] [/TD]
[TD][/TD]
[TD]=MAX(A7,$G$1)[/TD]
[TD]=MIN(B7,$H$1)[/TD]
[TD]=IF(E7-D7<0,0,E7-D7+1)[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]43674[/TD]
[TD] [/TD]
[TD][/TD]
[TD]=MAX(A8,$G$1)[/TD]
[TD]=MIN(B8,$H$1)[/TD]
[TD]=IF(E8-D8<0,0,E8-D8+1)[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]43674[/TD]
[TD]43660[/TD]
[TD][/TD]
[TD]=MAX(A9,$G$1)[/TD]
[TD]=MIN(B9,$H$1)[/TD]
[TD]=IF(E9-D9<0,0,E9-D9+1)[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]43674[/TD]
[TD] [/TD]
[TD][/TD]
[TD]=MAX(A10,$G$1)[/TD]
[TD]=MIN(B10,$H$1)[/TD]
[TD]=IF(E10-D10<0,0,E10-D10+1)[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]43642[/TD]
[TD]43682[/TD]
[TD][/TD]
[TD]=MAX(A11,$G$1)[/TD]
[TD]=MIN(B11,$H$1)[/TD]
[TD]=IF(E11-D11<0,0,E11-D11+1)[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

Is that what you needed?
 
Upvote 0
Beautiful! Thank you very much! This will save me a lot of time and errors.

If you could advise or point me in the direction of my next step that would be unbelievable. I then calculate total cost (column T) by simply number of days * price per day. But my monthly report requires to work out the total cost per category of tool. So the description (column L) looks like:

SUB BIT
SUB BIT
SUB LIFT
SUB CROSSOVER
SUB FLOAT
SUB FLOAT NM
SUB FLOAT NM
(x200 +)

So is there a way to work out the total costs for each description (all July "SUB CROSSOVER" combined , all "SUB BITS" combined etc). There are about 40 unique descriptions. This could be in separate a sheet or wherever.

Again any guidance greatly appreciated.

Thanks
 
Upvote 0
SirSquiddly,

So I've trimmed the example data for brevity (and to remove the entry where they returned it before they hired it).

I've combined the 3 worker columns into 1, "Days in July". which now has this copied down from row 2 to whichever row has the last data:
=IF(R2&S2="","",IF(MIN(S2,$Z$2)-MAX(R2,$Z$1)<0,0,MIN(S2,$Z$2)-MAX(R2,$Z$1)+1))

To get that hire charge for July I take the daily hire charge for that tool and multiply it by the number of days hired:
=IF(L2="","",INDEX(PricePerDay,MATCH(L2,Tool,0))*U2)

Copy those two formulae columns down as far as the last hire data you'll ever have.

Let me show you this on Sheet3 before I explain the Tool Table I've put onto Sheet4

LRSTUVZ
July charge
SUB CROSSOVER
SUB FLOAT
SUB FLOAT NM
SUB FLOAT NM
SUB CROSSOVER
SUB CROSSOVER

<tbody>
[TD="align: center"]1[/TD]
[TD="align: center"]Tool Hired[/TD]
[TD="align: center"]R[/TD]
[TD="align: center"]S[/TD]

[TD="align: center"]Days in July[/TD]
[TD="align: right"][/TD]
[TD="bgcolor: #FCE4D6, align: center"]01-Jul-19[/TD]

[TD="align: center"]2[/TD]

[TD="align: center"]22-May-19[/TD]
[TD="align: center"]08-Jun-19[/TD]
[TD="align: right"] £ -[/TD]
[TD="align: center"]0[/TD]
[TD="align: right"][/TD]
[TD="align: center"]31-Jul-19[/TD]

[TD="align: center"]3[/TD]

[TD="align: center"]02-Jun-19[/TD]
[TD="align: center"][/TD]
[TD="align: right"] £ 255.75[/TD]
[TD="align: center"]31[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]4[/TD]

[TD="align: center"]24-May-19[/TD]
[TD="align: center"][/TD]
[TD="align: right"] £ 341.00[/TD]
[TD="align: center"]31[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]5[/TD]

[TD="align: center"]28-Jul-19[/TD]
[TD="align: center"][/TD]
[TD="align: right"] £ 44.00[/TD]
[TD="align: center"]4[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]6[/TD]

[TD="align: center"]21-Jul-19[/TD]
[TD="align: center"]27-Jul-19[/TD]
[TD="align: right"] £ 84.00[/TD]
[TD="align: center"]7[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]7[/TD]

[TD="align: center"]26-Jun-19[/TD]
[TD="align: center"]05-Aug-19[/TD]
[TD="align: right"] £ 372.00[/TD]
[TD="align: center"]31[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

</tbody>
Sheet3

[TABLE="width: 85%"]
<tbody>[TR]
[TD]Worksheet Formulas[TABLE="width: 100%"]
<tbody>[TR="bgcolor: #DAE7F5"]
[TH]Cell[/TH]
[TH="align: left"]Formula[/TH]
[/TR]
[TR]
[TH="bgcolor: #DAE7F5"]T1[/TH]
[TD="align: left"]=TEXT(Z1,"mmmm")&" charge"[/TD]
[/TR]
[TR]
[TH="bgcolor: #DAE7F5"]U1[/TH]
[TD="align: left"]="Days in "&TEXT(Z1,"mmmm")[/TD]
[/TR]
[TR]
[TH="bgcolor: #DAE7F5"]T2[/TH]
[TD="align: left"]=IF(L2="","",INDEX(PricePerDay,MATCH(L2,Tool,0))*U2)[/TD]
[/TR]
[TR]
[TH="bgcolor: #DAE7F5"]U2[/TH]
[TD="align: left"]=IF(R2&S2="","",IF(MIN(S2,$Z$2)-MAX(R2,$Z$1)<0,0,MIN(S2,$Z$2)-MAX(R2,$Z$1)+1))[/TD]
[/TR]
[TR]
[TH="bgcolor: #DAE7F5"]Z2[/TH]
[TD="align: left"]=EOMONTH(Z1,0)[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]

[TABLE="width: 85%"]
<tbody>[TR]
[TD]Workbook Defined Names[TABLE="width: 100%"]
<tbody>[TR="bgcolor: #DAE7F5"]
[TH]Name[/TH]
[TH="align: left"]Refers To[/TH]
[/TR]
[TR]
[TH="bgcolor: #DAE7F5"]PricePerDay[/TH]
[TD="align: left"]=Sheet4!$B$2:$B$6[/TD]
[/TR]
[TR]
[TH="bgcolor: #DAE7F5"]Tool[/TH]
[TD="align: left"]=Sheet4!$A$2:$A$6[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]


So Sheet4 is the Tool reference which is created by entering the headings (no hyphens or spaces, just underscores as separators) and then your Tool description and PricePerDay.

Then highlight all the cells and Insert, Table. Then with those cells still highlighted select Formulas, Create from Selection and use the Top row as the name. To add a new Tool go to the last cell and press Tab.
For MonthTotal enter
=SUMIFS(Sheet3!$T$2:$T$999,Sheet3!$L$2:$L$999,[@Tool])
where $999 is the last row you'll ever have hire data on Sheet3 and the Excel Table will automatically fill the formula down that column and add it if you add a new Tool row.

When you're done you can use Table Design and select Total Row to set a grand total for the month.

ABC
ToolPricePerDayMonthTotal
SUB BIT
SUB LIFT
SUB CROSSOVER
SUB FLOAT
SUB FLOAT NM
Total

<tbody>
[TD="align: center"]1[/TD]

[TD="align: center"]2[/TD]

[TD="align: right"] £ 5.50[/TD]
[TD="align: right"] £ -[/TD]

[TD="align: center"]3[/TD]

[TD="align: right"] £ 25.00[/TD]
[TD="align: right"] £ -[/TD]

[TD="align: center"]4[/TD]

[TD="align: right"] £ 12.00[/TD]
[TD="align: right"] £ 456.00[/TD]

[TD="align: center"]5[/TD]

[TD="align: right"] £ 8.25[/TD]
[TD="align: right"] £ 255.75[/TD]

[TD="align: center"]6[/TD]

[TD="align: right"] £ 11.00[/TD]
[TD="align: right"] £ 385.00[/TD]

[TD="align: center"]7[/TD]

[TD="align: right"][/TD]
[TD="align: right"] £ 1,096.75[/TD]

</tbody>
Sheet4

[TABLE="width: 85%"]
<tbody>[TR]
[TD]Worksheet Formulas[TABLE="width: 100%"]
<tbody>[TR="bgcolor: #DAE7F5"]
[TH]Cell[/TH]
[TH="align: left"]Formula[/TH]
[/TR]
[TR]
[TH="bgcolor: #DAE7F5"]C2[/TH]
[TD="align: left"]=SUMIFS(Sheet3!$T$2:$T$999,Sheet3!$L$2:$L$999,[@Tool])[/TD]
[/TR]
[TR]
[TH="bgcolor: #DAE7F5"]C7[/TH]
[TD="align: left"]=SUBTOTAL(109,[MonthTotal])[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]

[TABLE="width: 85%"]
<tbody>[TR]
[TD]Workbook Defined Names[TABLE="width: 100%"]
<tbody>[TR="bgcolor: #DAE7F5"]
[TH]Name[/TH]
[TH="align: left"]Refers To[/TH]
[/TR]
[TR]
[TH="bgcolor: #DAE7F5"]MonthTotal[/TH]
[TD="align: left"]=Sheet4!$C$2:$C$6[/TD]
[/TR]
[TR]
[TH="bgcolor: #DAE7F5"]Tool[/TH]
[TD="align: left"]=Sheet4!$A$2:$A$6[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]


On Sheet3 you enter the Tool Hired rows, start hire date and end hire dates into columns L, R and S.
In cell Z1 enter the first of the month you want calculated.
Columns T and U will show the charge and active days of hire for the selected month.
Sheet4 must have unique Tool descriptions but will then show you thetotal by Tool for the selected month.
 
Upvote 0
Agh oops!!! I should have been more clear....

Because there are different sizes within each category, there are different price ranges per day... so total days x 1 day price will be inaccurate. What I think we need to do is somehow get the tool category total from the sum of each (days * day price). But I am not sure how to go about this.


[TABLE="class: cms_table"]
<tbody style="border-collapse: collapse; border-spacing: 0px 0px; font-size: 13px; margin-bottom: 0px;">[TR="bgcolor: #DAE7F5"]
[TH="align: center"][/TH]
[TH="align: center"]L[/TH]
[TH="align: center"]T[/TH]
[TH="align: center"][/TH]
[/TR]
[TR]
[TD="align: center"]1[/TD]
[TD]SUB LIFT[/TD]
[TD] £50[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: center"]2[/TD]
[TD]SUB BIT[/TD]
[TD="align: right"]£100[/TD]
[TD="align: right"][/TD]
[/TR]
[TR]
[TD="align: center"]3[/TD]
[TD]SUB LIFT[/TD]
[TD="align: right"] £ 25.00[/TD]
[TD="align: right"][/TD]
[/TR]
[TR]
[TD="align: center"]4[/TD]
[TD]SUB CROSSOVER[/TD]
[TD="align: right"] £ 12.00[/TD]
[TD="align: right"][/TD]
[/TR]
[TR]
[TD="align: center"]5[/TD]
[TD]SUB BIT[/TD]
[TD="align: right"] £ 200[/TD]
[TD="align: right"][/TD]
[/TR]
[TR]
[TD="align: center"]6[/TD]
[TD]SUB FLOAT NM[/TD]
[TD="align: right"] £ 100[/TD]
[TD="align: right"][/TD]
[/TR]
[TR]
[TD="align: center"][/TD]
[TD][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[/TR]
</tbody>[/TABLE]
So from the above table, I need:

1. SUB BIT £300
2. SUB LIFT £75
3. SUB FLOAT £100
ETC.


Is this possible?
 
Upvote 0
Yes, that's the column on the Tool table MonthTotal.

So if I change the test data to match your latest entries:

LRSTUVZ
July charge
SUB LIFT
SUB BIT
SUB LIFT
SUB CROSSOVER
SUB BIT
SUB FLOAT NM

<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
[TD="align: center"]1[/TD]
[TD="align: center"]Tool Hired[/TD]
[TD="align: center"]R[/TD]
[TD="align: center"]S[/TD]

[TD="align: center"]Days in July[/TD]
[TD="align: right"][/TD]
[TD="bgcolor: #FCE4D6, align: center"]01-Jul-19[/TD]

[TD="align: center"]2[/TD]

[TD="align: center"]21-Jul-19[/TD]
[TD="align: center"]22-Jul-19[/TD]
[TD="align: right"] £ 50.00 [/TD]
[TD="align: center"]2[/TD]
[TD="align: right"][/TD]
[TD="align: center"]31-Jul-19[/TD]

[TD="align: center"]3[/TD]

[TD="align: center"]22-Jul-19[/TD]
[TD="align: center"]22-Jul-19[/TD]
[TD="align: right"] £ 100.00 [/TD]
[TD="align: center"]1[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]4[/TD]

[TD="align: center"]01-Jul-19[/TD]
[TD="align: center"]01-Jul-19[/TD]
[TD="align: right"] £ 25.00 [/TD]
[TD="align: center"]1[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]5[/TD]

[TD="align: center"]29-Jul-19[/TD]
[TD="align: center"]29-Jul-19[/TD]
[TD="align: right"] £ 12.00 [/TD]
[TD="align: center"]1[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]6[/TD]

[TD="align: center"]29-Jul-19[/TD]
[TD="align: center"]30-Jul-19[/TD]
[TD="align: right"] £ 200.00 [/TD]
[TD="align: center"]2[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]7[/TD]

[TD="align: center"]21-Jul-19[/TD]
[TD="align: center"]30-Jul-19[/TD]
[TD="align: right"] £ 100.00 [/TD]
[TD="align: center"]10[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

</tbody>
Sheet3

[TABLE="width: 85%"]
<tbody>[TR]
[TD]Worksheet Formulas[TABLE="width: 100%"]
<thead>[TR="bgcolor: #DAE7F5"]
[TH="width: 10px"]Cell[/TH]
[TH="align: left"]Formula[/TH]
[/TR]
</thead><tbody>[TR]
[TH="width: 10px, bgcolor: #DAE7F5"]T1[/TH]
[TD="align: left"]=TEXT(Z1,"mmmm")&" charge"[/TD]
[/TR]
[TR]
[TH="width: 10px, bgcolor: #DAE7F5"]U1[/TH]
[TD="align: left"]="Days in "&TEXT(Z1,"mmmm")[/TD]
[/TR]
[TR]
[TH="width: 10px, bgcolor: #DAE7F5"]T2[/TH]
[TD="align: left"]=IF(L2="","",INDEX(PricePerDay,MATCH(L2,Tool,0))*U2)[/TD]
[/TR]
[TR]
[TH="width: 10px, bgcolor: #DAE7F5"]U2[/TH]
[TD="align: left"]=IF(R2&S2="","",IF(MIN(S2,$Z$2)-MAX(R2,$Z$1)<0,0,MIN(S2,$Z$2)-MAX(R2,$Z$1)+1))[/TD]
[/TR]
[TR]
[TH="width: 10px, bgcolor: #DAE7F5"]Z2
[/TH]
[TD="align: left"]=EOMONTH(Z1,0)[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]

[TABLE="width: 85%"]
<tbody>[TR]
[TD]Workbook Defined Names[TABLE="width: 100%"]
<thead>[TR="bgcolor: #DAE7F5"]
[TH="width: 10px"]Name[/TH]
[TH="align: left"]Refers To[/TH]
[/TR]
</thead><tbody>[TR]
[TH="width: 10px, bgcolor: #DAE7F5"]PricePerDay[/TH]
[TD="align: left"]=Sheet4!$B$2:$B$6[/TD]
[/TR]
[TR]
[TH="width: 10px, bgcolor: #DAE7F5"]Tool[/TH]
[TD="align: left"]=Sheet4!$A$2:$A$6[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]



...then the Tool table shows the totals for each Tool:

ABC
ToolPricePerDayMonthTotal
SUB BIT
SUB LIFT
SUB CROSSOVER
SUB FLOAT
SUB FLOAT NM
Total

<colgroup><col style="width: 25pxpx"><col><col><col></colgroup><thead>
</thead><tbody>
[TD="align: center"]1[/TD]

[TD="align: center"]2[/TD]

[TD="align: right"] £ 100.00 [/TD]
[TD="align: right"] £ 300.00 [/TD]

[TD="align: center"]3[/TD]

[TD="align: right"] £ 25.00 [/TD]
[TD="align: right"] £ 75.00 [/TD]

[TD="align: center"]4[/TD]

[TD="align: right"] £ 12.00 [/TD]
[TD="align: right"] £ 12.00 [/TD]

[TD="align: center"]5[/TD]

[TD="align: right"] £ 8.25 [/TD]
[TD="align: right"] £ - [/TD]

[TD="align: center"]6[/TD]

[TD="align: right"] £ 10.00 [/TD]
[TD="align: right"] £ 100.00 [/TD]

[TD="align: center"]7[/TD]

[TD="align: right"][/TD]
[TD="align: right"] £ 487.00 [/TD]

</tbody>
Sheet4

[TABLE="width: 85%"]
<tbody>[TR]
[TD]Worksheet Formulas[TABLE="width: 100%"]
<thead>[TR="bgcolor: #DAE7F5"]
[TH="width: 10px"]Cell[/TH]
[TH="align: left"]Formula[/TH]
[/TR]
</thead><tbody>[TR]
[TH="width: 10px, bgcolor: #DAE7F5"]C2[/TH]
[TD="align: left"]=SUMIFS(Sheet3!$T$2:$T$999,Sheet3!$L$2:$L$999,[@Tool])[/TD]
[/TR]
[TR]
[TH="width: 10px, bgcolor: #DAE7F5"]C7
[/TH]
[TD="align: left"]=SUBTOTAL(109,[MonthTotal])[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]

[TABLE="width: 85%"]
<tbody>[TR]
[TD]Workbook Defined Names[TABLE="width: 100%"]
<thead>[TR="bgcolor: #DAE7F5"]
[TH="width: 10px"]Name[/TH]
[TH="align: left"]Refers To[/TH]
[/TR]
</thead><tbody>[TR]
[TH="width: 10px, bgcolor: #DAE7F5"]MonthTotal[/TH]
[TD="align: left"]=Sheet4!$C$2:$C$6[/TD]
[/TR]
[TR]
[TH="width: 10px, bgcolor: #DAE7F5"]Tool[/TH]
[TD="align: left"]=Sheet4!$A$2:$A$6[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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