Hi everyone,
I have a bit of convoluted question regarding multiplying dynamic amounts based on date and time conditions. I have tried a fair few different formulas including sumproduct, vlookup and ifs - but nothing gives the right answer. This is quite a large sheet so I have only copied half here as I can't post anything larger.
I need to design a sheet where the user will input hours worked in column D so we can work out how many hours someone worked in a contract period (see B6) and work out any repayments that are potentially available.
As people generally don't start their contracts that align exactly with the repayment period that we can access, I have transposed the repayment period calculation into columns L-AK, and then worked out the daily rate in the yellow cell matrix. (e.g. This contract started on the 06/01 - however the repayment period we are accessing started on the 01/01. L14 says that they worked 7 days in the first period of 01/01 - 14/01, then the 13 and 14/01 are counted in the next repaynent period).
I am looking for a formula that can multiple the daily rate (G), by it's corresponding repayment period - G14 would align with L14, G15 would align with M14 AND M15. And then add everything from that row in the total hours. For example in row 14 of the larger matrix:
- 10 hours worked in the first week = 1.43 daily hours. (G14)
1.43*7 = 10.0 (g14*L14)
-.71*2 = 1.42 (g14*m14)
Total hours in row= 11.42 worked in that repayment period range.
The problem I have is that if any weeks are missing or equal 0, we inevitably get a value error. Ideally we need to assess up to 6 months of their contract (total rows is actually B14:B39).
I really hope this makes sense as I've been wracking my brain trying to figure out what will work. If further clarifying details are needed - I can post. Or, if a fully sheet is preferred, I can post a link to the full sheet.
Thank you.
I have a bit of convoluted question regarding multiplying dynamic amounts based on date and time conditions. I have tried a fair few different formulas including sumproduct, vlookup and ifs - but nothing gives the right answer. This is quite a large sheet so I have only copied half here as I can't post anything larger.
I need to design a sheet where the user will input hours worked in column D so we can work out how many hours someone worked in a contract period (see B6) and work out any repayments that are potentially available.
As people generally don't start their contracts that align exactly with the repayment period that we can access, I have transposed the repayment period calculation into columns L-AK, and then worked out the daily rate in the yellow cell matrix. (e.g. This contract started on the 06/01 - however the repayment period we are accessing started on the 01/01. L14 says that they worked 7 days in the first period of 01/01 - 14/01, then the 13 and 14/01 are counted in the next repaynent period).
I am looking for a formula that can multiple the daily rate (G), by it's corresponding repayment period - G14 would align with L14, G15 would align with M14 AND M15. And then add everything from that row in the total hours. For example in row 14 of the larger matrix:
- 10 hours worked in the first week = 1.43 daily hours. (G14)
1.43*7 = 10.0 (g14*L14)
-.71*2 = 1.42 (g14*m14)
Total hours in row= 11.42 worked in that repayment period range.
The problem I have is that if any weeks are missing or equal 0, we inevitably get a value error. Ideally we need to assess up to 6 months of their contract (total rows is actually B14:B39).
I really hope this makes sense as I've been wracking my brain trying to figure out what will work. If further clarifying details are needed - I can post. Or, if a fully sheet is preferred, I can post a link to the full sheet.
Repayment Test.xlsx | ||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | G | H | I | J | K | L | M | N | AL | ||||||||||||||||||||||||||
1 | Repayment Calulator | |||||||||||||||||||||||||||||||||||||||
2 | ||||||||||||||||||||||||||||||||||||||||
3 | ||||||||||||||||||||||||||||||||||||||||
4 | ||||||||||||||||||||||||||||||||||||||||
5 | ||||||||||||||||||||||||||||||||||||||||
6 | Contract Type | Weekly | 7 | |||||||||||||||||||||||||||||||||||||
7 | Repayment Frequency | Fortnightly | 14 | 40 | ||||||||||||||||||||||||||||||||||||
8 | Repayment Start | 1/01/2022 | ||||||||||||||||||||||||||||||||||||||
9 | Repayment End | 2/07/2022 | PAYMENT AMOUNT HELPER | |||||||||||||||||||||||||||||||||||||
10 | Total Repayment | $769.23 | ||||||||||||||||||||||||||||||||||||||
11 | Contract Start | 6/01/2022 | ||||||||||||||||||||||||||||||||||||||
12 | ||||||||||||||||||||||||||||||||||||||||
13 | Contract Start | Contract Type End | Hours | Other | Total Hours | Daily Rate HRS | Cumulative Average Hours | Repayment Start | Repayment End | 12/01/2022 | 19/01/2022 | ######## | Total Hours Worked in Repayment Period | |||||||||||||||||||||||||||
14 | 1 | 6/01/2022 | 12/01/2022 | 10 | 10 | 1.43 | 10.00 | 1/01/2022 | 14/01/2022 | 7.00 | 2.00 | 0.00 | ||||||||||||||||||||||||||||
15 | 2 | 13/01/2022 | 19/01/2022 | 5 | 5 | 0.71 | 7.50 | 15/01/2022 | 28/01/2022 | 0.00 | 5.00 | 7.00 | ||||||||||||||||||||||||||||
16 | 3 | 20/01/2022 | 26/01/2022 | 11 | 11 | 1.57 | 8.67 | 29/01/2022 | 11/02/2022 | 0.00 | 0.00 | 0.00 | ||||||||||||||||||||||||||||
17 | 4 | 27/01/2022 | 2/02/2022 | 12 | 12 | 1.71 | 9.50 | 12/02/2022 | 25/02/2022 | 0.00 | 0.00 | 0.00 | ||||||||||||||||||||||||||||
18 | 5 | 3/02/2022 | 9/02/2022 | 9 | 9 | 1.29 | 9.40 | 26/02/2022 | 11/03/2022 | 0.00 | 0.00 | 0.00 | ||||||||||||||||||||||||||||
19 | 6 | 10/02/2022 | 16/02/2022 | 4 | 4 | 0.57 | 8.50 | 12/03/2022 | 25/03/2022 | 0.00 | 0.00 | 0.00 | ||||||||||||||||||||||||||||
20 | 7 | 17/02/2022 | 23/02/2022 | 1 | 1 | 0.14 | 7.43 | 26/03/2022 | 8/04/2022 | 0.00 | 0.00 | 0.00 | ||||||||||||||||||||||||||||
21 | 8 | 24/02/2022 | 2/03/2022 | 10 | 10 | 1.43 | 7.75 | 9/04/2022 | 22/04/2022 | 0.00 | 0.00 | 0.00 | ||||||||||||||||||||||||||||
22 | 9 | 3/03/2022 | 9/03/2022 | 10 | 10 | 1.43 | 8.00 | 23/04/2022 | 6/05/2022 | 0.00 | 0.00 | 0.00 | ||||||||||||||||||||||||||||
23 | 10 | 10/03/2022 | 16/03/2022 | 14 | 14 | 2.00 | 8.60 | 7/05/2022 | 20/05/2022 | 0.00 | 0.00 | 0.00 | ||||||||||||||||||||||||||||
24 | 11 | 17/03/2022 | 23/03/2022 | 20 | 20 | 2.86 | 9.64 | 21/05/2022 | 3/06/2022 | 0.00 | 0.00 | 0.00 | ||||||||||||||||||||||||||||
25 | 12 | 24/03/2022 | 30/03/2022 | 18 | 18 | 2.57 | 10.33 | 4/06/2022 | 17/06/2022 | 0.00 | 0.00 | 0.00 | ||||||||||||||||||||||||||||
26 | 13 | 31/03/2022 | 6/04/2022 | 30 | 30 | 4.29 | 11.85 | 18/06/2022 | 1/07/2022 | 0.00 | 0.00 | 0.00 | ||||||||||||||||||||||||||||
27 | 14 | 7/04/2022 | 13/04/2022 | |||||||||||||||||||||||||||||||||||||
28 | 15 | 14/04/2022 | 20/04/2022 | |||||||||||||||||||||||||||||||||||||
Sheet1 |
Cell Formulas | ||
---|---|---|
Range | Formula | |
D6 | D6 | =IFS(B6="Weekly","7",B6="Fortnightly","14",B6="Monthly","30.41") |
D7 | D7 | =IFS(B7="Fortnightly","14",B7="Monthly","30.41",B7="Quarterly","91",B7="Milestone", "91",B7="Lump Sum","182") |
E7 | E7 | =IFS(B7="Fortnightly","40",B7="Monthly","86.60",B7="Quarterly","260",B7="Milestone", "260",B7="Lump Sum","520") |
B9 | B9 | =IF($B$2="A",$B$8+91,$B$8+182) |
D10 | D10 | =IFS(B7="Fortnightly","$769.23",B7="Monthly","$1,666.67",B7="Quarterly","$5,000",B7="Milestone", "$5,000",B7="Lump Sum","$10,000") |
L13:AK13 | L13 | =TRANSPOSE(UNIQUE(C14#)) |
B14:B39 | B14 | =LET(p,MATCH(B6,{"Weekly","Fortnightly","Monthly"},0),SEQUENCE(CHOOSE(p,26,13,6),,B11,CHOOSE(p,7,14,30.41))) |
C14:C39 | C14 | =B14#+IF(B6="Weekly",6,IF(B6="Monthly",29.41,13)) |
F14:F28 | F14 | =IF(D14+E14=0,"",D14+E14) |
G14:G28 | G14 | =IF(F14<>"",IFS($B$6="Weekly",F14/$D$6,$B$6="Fortnightly",F14/$D$6,$B$6="Monthly",F14/$D$6),"") |
H14 | H14 | =IF(F14<>"",IFS($B$6="Weekly",$F$14/1,$B$6="Fortnightly",$F$14/1,$B$6="Monthly",$F$14/1),"") |
H15 | H15 | =IF(F15<>"",IFS($B$6="Weekly",SUM($F$14:F15/2),$B$6="Fortnightly",SUM($F$14:$F$15/2),$B$6="Monthly",SUM($F$14:F15/2)),"") |
H16 | H16 | =IF(F16<>"",IFS($B$6="Weekly",SUM($F$14:F16/3),$B$6="Fortnightly",SUM($F$14:$F$16/3),$B$6="Monthly",SUM($F$14:F16/3)),"") |
H17 | H17 | =IF(F17<>"",IFS($B$6="Weekly",SUM($F$14:F17/4),$B$6="Fortnightly",SUM($F$14:$F$17/4),$B$6="Monthly",SUM($F$14:F17/4)),"") |
H18 | H18 | =IF(F18<>"",IFS($B$6="Weekly",SUM($F$14:F18/5),$B$6="Fortnightly",SUM($F$14:$F$18/5),$B$6="Monthly",SUM($F$14:F18/5)),"") |
H19 | H19 | =IF(F19<>"",IFS($B$6="Weekly",SUM($F$14:F19/6),$B$6="Fortnightly",SUM($F$14:$F$19/6),$B$6="Monthly",SUM($F$14:F19/6)),"") |
H20 | H20 | =IF(F20<>"",IFS($B$6="Weekly",SUM($F$14:F20/7),$B$6="Fortnightly",SUM($F$14:$F$20/7),$B$6="Monthly",""),"") |
H21 | H21 | =IF(F21<>"",IFS($B$6="Weekly",SUM($F$14:F21/8),$B$6="Fortnightly",SUM($F$14:F21/8),$B$6="Monthly",""),"") |
H22 | H22 | =IF(F22<>"",IFS($B$6="Weekly",SUM($F$14:F22/9),$B$6="Fortnightly",SUM($F$14:$F$22/9),$B$6="Monthly",""),"") |
H23 | H23 | =IF(F23<>"",IFS($B$6="Weekly",SUM($F$14:F23/10),$B$6="Fortnightly",SUM($F$14:F23/10),$B$6="Monthly",""),"") |
H24 | H24 | =IF(F24<>"",IFS($B$6="Weekly",SUM($F$14:F24/11),$B$6="Fortnightly",SUM($F$14:$F$24/11),$B$6="Monthly",""),"") |
H25 | H25 | =IF(F25<>"",IFS($B$6="Weekly",SUM($F$14:F25/12),$B$6="Fortnightly",SUM($F$14:F25/12),$B$6="Monthly",""),"") |
H26 | H26 | =IF(F26<>"",IFS($B$6="Weekly",SUM($F$14:F26/13),$B$6="Fortnightly",SUM($F$14:F26/13),$B$6="Monthly",""),"") |
H27 | H27 | =IF(F27<>"",IFS($B$6="Weekly",SUM($F$14:F27/14),$B$6="Fortnightly","",$B$6="Monthly",""),"") |
H28 | H28 | =IF(F28<>"",IFS($B$6="Weekly",SUM($F$14:F28/15),$B$6="Fortnightly","",$B$6="Monthly",""),"") |
J14:J26 | J14 | =LET(p,MATCH(B7,{"Fortnightly","Monthly","Quarterly","Milestone","Lump Sum"},0),SEQUENCE(CHOOSE(p,13,6,2,2,1),,B8,CHOOSE(p,14,30.41,91,91,182))) |
K14:K26 | K14 | =J14#+IFS(B2="A",90,B7="Fortnightly",13,B7="Monthly",29.41,B7="Quarterly",90,B7="Quarterly",90,B7="Milestone",90,B7="Lump Sum",181) |
L14,M15,N16 | L14 | =IF($J14<>"",LET(y,SEQUENCE($K14-$J14+1),x,TRANSPOSE($J14+y-1),MMULT((x>=$B14)*(x<=$C14),y^0)),"") |
M14,N15 | M14 | =IF($J14<>"",LET(y,SEQUENCE($K14-$J14+1),x,TRANSPOSE($J14+y-1),MMULT((x>=$B15)*(x<=$C15),y^0)),"") |
N14 | N14 | =IF($J14<>"",LET(y,SEQUENCE($K14-$J14+1),x,TRANSPOSE($J14+y-1),MMULT((x>=$B16)*(x<=$C16),y^0)),"") |
L15,M16,N17 | L15 | =IF($J15<>"",LET(y,SEQUENCE($K15-$J15+1),x,TRANSPOSE($J15+y-1),MMULT((x>=$B14)*(x<=$C14),y^0)),"") |
L16,M17,N18 | L16 | =IF($J16<>"",LET(y,SEQUENCE($K16-$J16+1),x,TRANSPOSE($J16+y-1),MMULT((x>=$B14)*(x<=$C14),y^0)),"") |
L17,M18,N19 | L17 | =IF($J17<>"",LET(y,SEQUENCE($K17-$J17+1),x,TRANSPOSE($J17+y-1),MMULT((x>=$B14)*(x<=$C14),y^0)),"") |
L18,M19,N20 | L18 | =IF($J18<>"",LET(y,SEQUENCE($K18-$J18+1),x,TRANSPOSE($J18+y-1),MMULT((x>=$B14)*(x<=$C14),y^0)),"") |
L19,M20,N21 | L19 | =IF($J19<>"",LET(y,SEQUENCE($K19-$J19+1),x,TRANSPOSE($J19+y-1),MMULT((x>=$B14)*(x<=$C14),y^0)),"") |
L20,M21,N22 | L20 | =IF($J20<>"",LET(y,SEQUENCE($K20-$J20+1),x,TRANSPOSE($J20+y-1),MMULT((x>=$B14)*(x<=$C14),y^0)),"") |
L21,M22,N23 | L21 | =IF($J21<>"",LET(y,SEQUENCE($K21-$J21+1),x,TRANSPOSE($J21+y-1),MMULT((x>=$B14)*(x<=$C14),y^0)),"") |
L22,M23,N24 | L22 | =IF($J22<>"",LET(y,SEQUENCE($K22-$J22+1),x,TRANSPOSE($J22+y-1),MMULT((x>=$B14)*(x<=$C14),y^0)),"") |
L23,M24,N25 | L23 | =IF($J23<>"",LET(y,SEQUENCE($K23-$J23+1),x,TRANSPOSE($J23+y-1),MMULT((x>=$B14)*(x<=$C14),y^0)),"") |
L24,M25,N26 | L24 | =IF($J24<>"",LET(y,SEQUENCE($K24-$J24+1),x,TRANSPOSE($J24+y-1),MMULT((x>=$B14)*(x<=$C14),y^0)),"") |
L25,M26,N27 | L25 | =IF($J25<>"",LET(y,SEQUENCE($K25-$J25+1),x,TRANSPOSE($J25+y-1),MMULT((x>=$B14)*(x<=$C14),y^0)),"") |
L26,M27,N28 | L26 | =IF($J26<>"",LET(y,SEQUENCE($K26-$J26+1),x,TRANSPOSE($J26+y-1),MMULT((x>=$B14)*(x<=$C14),y^0)),"") |
L27,M28 | L27 | =IF($J27<>"",LET(y,SEQUENCE($K27-$J27+1),x,TRANSPOSE($J27+y-1),MMULT((x>=$B14)*(x<=$C14),y^0)),"") |
L28 | L28 | =IF($J28<>"",LET(y,SEQUENCE($K28-$J28+1),x,TRANSPOSE($J28+y-1),MMULT((x>=$B14)*(x<=$C14),y^0)),"") |
A14:A28 | A14 | =IFERROR(INT((B14+5-DATE(YEAR(B14+365),-11,-1))/7),"") |
Dynamic array formulas. |
Cells with Conditional Formatting | ||||
---|---|---|---|---|
Cell | Condition | Cell Format | Stop If True | |
H14:H39 | Expression | =AND($B$6="Monthly",$H14<86.8) | text | NO |
H14:H39 | Expression | =AND($B$6="Fortnightly",$H14<40) | text | NO |
H14:H39 | Expression | =AND($B$6="WEEKLY",$H14<20) | text | NO |
L14:AK39 | Cell Value | =0 | text | NO |
Thank you.
Last edited: