# Calculate a price for a item which was rented on different day's

#### ROMANVR

##### New Member
I Have a item " spoon "
Price is €0.07 per day
One customer who has ordered 50 spoons on 1.11.20 ( and still has not returned them).
On the 7.11.20 he orders another 40 spoons.
On the 14.11.20 another 20.

On the 21.11.20 he returned 30 spoons ( I would charge him 21 days at € 0.07)
On the 28.11.20 he returned 30 spoons (I would charge him 20 spoons for 28 days and 10 spoons for 21 days) .
Basically I want to be able to calculate the price for a item withe a different start day.
Hope it makes sense and someone can help))

### Excel Facts

Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().

##### Well-known Member
Use this Formulas:
For first Value You can Use different formula, For others use G7 Formula

data validation list - Bkisley - 1.xlsm
ABCDEFGH
1Item NumberTotal
2DateItem NameOrderedReturnedOrderedReturned
311/1/2020Spoon505000
411/7/2020Spoon409000
511/14/2020Spoon2011000
611/21/2020Spoon40301503044.1
711/28/2020Spoon301506054.6
812/5/2020Spoon60150120102.2
9
Sheet3
Cell Formulas
RangeFormula
E3:E8E3=SUM(\$C\$3:C3)
F3:F8F3=SUM(\$D\$3:D3)
G3:G6G3=((F3-IFNA(INDEX(\$A\$3:\$F\$8,MATCH(F3,\$E\$3:\$E\$8,1),5),0))*(A3+1-INDEX(\$A\$3:\$F\$8,IFNA(MATCH(F3,\$E\$3:\$E\$8,1)+1,1),1))+IF(D3-IFNA(INDEX(\$A\$3:\$F\$8,IFNA(MATCH(F3,\$E\$3:\$E\$8,1),1),5),0)<0,0,IF(D3-((F3-IFNA(INDEX(\$A\$3:\$F\$8,IFNA(MATCH(F3,\$E\$3:\$E\$8,1),1),5),0)))>=INDEX(\$A\$3:\$F\$8,MATCH(F3,\$E\$3:\$E\$8,1),3),INDEX(\$A\$3:\$F\$8,MATCH(F3,\$E\$3:\$E\$8,1),3),D3-((F3-IFNA(INDEX(\$A\$3:\$F\$8,IFNA(MATCH(F3,\$E\$3:\$E\$8,1),1),5),0)))))*(A3+1-INDEX(\$A\$3:\$F\$8,IFNA(MATCH(F3,\$E\$3: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E\$8,1)-1,1))))*0.07

##### Well-known Member
Also You can Use this formula at G3 and Drag it Down until last row.
Excel Formula:
``=(IF(F3<IFNA(INDEX(\$A\$3:\$F\$8,IFNA(MATCH(F3,\$E\$3:\$E\$8,1),1),5),0),D3,(F3-IFNA(INDEX(\$A\$3:\$F\$8,IFNA(MATCH(F3,\$E\$3:\$E\$8,1),1),5),0)))*(A3+1-IFNA(INDEX(\$A\$3:\$F\$8,IFNA(MATCH(F3,\$E\$3:\$E\$8,1)+1,1),1),0))+IF(F3<IFNA(INDEX(\$A\$3:\$F\$8,IFNA(MATCH(F3,\$E\$3:\$E\$8,1),1),5),0),0,IF(D3-((F3-IFNA(INDEX(\$A\$3:\$F\$8,MATCH(F3,\$E\$3:\$E\$8,1),5),0)))>=INDEX(\$A\$3:\$F\$8,IFNA(MATCH(F3,\$E\$3:\$E\$8,1),0),3),INDEX(\$A\$3:\$F\$8,IFNA(MATCH(F3,\$E\$3:\$E\$8,1),0),3),D3-((F3-IFNA(INDEX(\$A\$3:\$F\$8,IFNA(MATCH(F3,\$E\$3:\$E\$8,1),1),5),0)))))*(A3+1-INDEX(\$A\$3:\$F\$8,IFNA(MATCH(F3,\$E\$3:\$E\$8,1),1),1))+IF(F3<IFNA(INDEX(\$A\$3:\$F\$8,IFNA(MATCH(F3,\$E\$3:\$E\$8,1),1),5),0),0,IF(D3-((F3-IFNA(INDEX(\$A\$3:\$F\$8,IFNA(MATCH(F3,\$E\$3:\$E\$8,1),0),5),0)))-INDEX(\$A\$3:\$F\$8,IFNA(MATCH(F3,\$E\$3:\$E\$8,1),1),3)<0,0,(D3-(F3-IFNA(INDEX(\$A\$3:\$F\$8,IFNA(MATCH(F3,\$E\$3:\$E\$8,1),1),5),0))-INDEX(\$A\$3:\$F\$8,IFNA(MATCH(F3,\$E\$3:\$E\$8,1),1),3))*(A3+1-INDEX(\$A\$3:\$F\$8,IFNA(MATCH(F3,\$E\$3:\$E\$8,1)-1,1),1)))))*0.07``

#### Dave Patton

##### Well-known Member
To calculate the balance owing, you can consider the number of units out per day
You could calculate the units per day * rate and then sum that column.
or use a formula

T202012c.xlsm
ABCDEF
1CustomerItemRateNumberDateCumulative
2spoon0.07501-Nov-2050
3spoon407-Nov-2090
4spoon2014-Nov-20110
5spoon-3021-Nov-2080
6-3028-Nov-2050
71-Dec-2050
8
95030168.70
10Less payments98.00
11Balance70.70
12
13Daily charge503.50
2b
Cell Formulas
RangeFormula
F2:F6F2=SUM(\$D\$2:D2)
D9D9=SUM(D2:D7)
E9E9=E7-E2
F9F9=SUMPRODUCT(F2:F6,E3:E7-E2:E6)*rSpoon
F11F11=F9-F10
D13D13=D9
F13F13=rSpoon*D13
Named Ranges
NameRefers ToCells
rSpoon='2b'!\$C\$2F13, F9

Replies
2
Views
183
Replies
6
Views
292
Replies
0
Views
419
Replies
7
Views
429
Replies
1
Views
106

1,129,467
Messages
5,636,456
Members
416,919
Latest member
twc2c

### 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.

### Which adblocker are you using?

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

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