Monthly number to be divided by dynamic values

thetnaingsoe

New Member
Joined
Nov 7, 2018
Messages
7
Office Version
  1. 365
Platform
  1. Windows
Hey everyone,

I have a table which defines what rate to be applied to each period (from cell A1 to B13).

In Row 16 and 17, there is old rate (cell A17) and new rate (cell B17). From cell C17 to N18 is monthly revenue.

Rate table defines that Jan 2023 and Feb 2023 are using the old rate and Mar 2023 to Dec 2023 are using the new rate.

Cell P17 will calculate the total hours for the year. Since Jan and Feb 2023 are using the old rates, revenue from that 2 periods are converted to hours using the old rate and Mar to Dec 2023 revenues are converted to hours using the new rate. Manual calculation will look like this =SUM(C17:D17)/A17+SUM(E17:N17)/B17

Is there a way to automate this calculation?

Thanks in advance!
 

Attachments

  • Monthly number to be divided by dynamic values.JPG
    Monthly number to be divided by dynamic values.JPG
    134.8 KB · Views: 13

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
This is a clunky formula, but I think it works:
Your formula is just as good, but it doesn't allow for changing the Old/New Rate in column B1:B13.

Mr Excel Questions.xlsx
ABCDEFGHIJKLMNO
1Monthrate typeHey everyone, I have a table which defines what rate to be applied to each period (from cell A1 to B13). In Row 16 and 17, there is old rate (cell A17) and new rate (cell B17). From cell C17 to N18 is monthly revenue. Rate table defines that Jan 2023 and Feb 2023 are using the old rate and Mar 2023 to Dec 2023 are using the new rate. Cell P17 will calculate the total hours for the year. Since Jan and Feb 2023 are using the old rates, revenue from that 2 periods are converted to hours using the old rate and Mar to Dec 2023 revenues are converted to hours using the new rate. Manual calculation will look like this =SUM(C17:D17)/A17+SUM(E17:N17)/B17 Is there a way to automate this calculation?
21/1/2023Old Rate
32/1/2023Old Rate
43/1/2023New Rate
54/1/2023New Rate
65/1/2023New Rate
76/1/2023New Rate
87/1/2023New Rate
98/1/2023New Rate
109/1/2023New Rate
1110/1/2023New Rate
1211/1/2023New Rate
1312/1/2023New Rate
14
15
16Old RateNew RateJan-23Feb-23Mar-23Apr-23May-23Jun-23Jul-23Aug-23Sep-23Oct-23Nov-23Dec-23
17$ 100$ 150$ 18,000$ 17,000$ 20,000$ 21,000$ 22,000$ 22,000$ 19,000$ 18,000$ 17,000$ 20,000$ 23,000$ 11,0001636.67
Sheet4
Cell Formulas
RangeFormula
O17O17=SUM($C$17:$N$17/XLOOKUP(INDEX($B$2:$B$13,XMATCH(C16:N16,$A$2:$A$13)),$A$16:$B$16,$A$17:$B$17))
 
Last edited:
Upvote 0
This is a clunky formula, but I think it works:
Mr Excel Questions.xlsx
ABCDEFGHIJKLMNO
1Monthrate typeHey everyone, I have a table which defines what rate to be applied to each period (from cell A1 to B13). In Row 16 and 17, there is old rate (cell A17) and new rate (cell B17). From cell C17 to N18 is monthly revenue. Rate table defines that Jan 2023 and Feb 2023 are using the old rate and Mar 2023 to Dec 2023 are using the new rate. Cell P17 will calculate the total hours for the year. Since Jan and Feb 2023 are using the old rates, revenue from that 2 periods are converted to hours using the old rate and Mar to Dec 2023 revenues are converted to hours using the new rate. Manual calculation will look like this =SUM(C17:D17)/A17+SUM(E17:N17)/B17 Is there a way to automate this calculation?
21/1/2023Old Rate
32/1/2023Old Rate
43/1/2023New Rate
54/1/2023New Rate
65/1/2023New Rate
76/1/2023New Rate
87/1/2023New Rate
98/1/2023New Rate
109/1/2023New Rate
1110/1/2023New Rate
1211/1/2023New Rate
1312/1/2023New Rate
14
15
16Old RateNew RateJan-23Feb-23Mar-23Apr-23May-23Jun-23Jul-23Aug-23Sep-23Oct-23Nov-23Dec-23
17$ 100$ 150$ 18,000$ 17,000$ 20,000$ 21,000$ 22,000$ 22,000$ 19,000$ 18,000$ 17,000$ 20,000$ 23,000$ 11,0001636.67
Sheet4
Cell Formulas
RangeFormula
O17O17=SUM($C$17:$N$17/XLOOKUP(INDEX($B$2:$B$13,XMATCH(C16:N16,$A$2:$A$13)),$A$16:$B$16,$A$17:$B$17))
It works perfect! Thank you so much!!!
 
Upvote 0
I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

This worked for me.

23 01 25.xlsm
ABCDEFGHIJKLMNO
1Monthrate type
21/01/2023Old Rate
31/02/2023Old Rate
41/03/2023New Rate
51/04/2023New Rate
61/05/2023New Rate
71/06/2023New Rate
81/07/2023New Rate
91/08/2023New Rate
101/09/2023New Rate
111/10/2023New Rate
121/11/2023New Rate
131/12/2023New Rate
14
15
16Old RateNew Rate1/01/20231/02/20231/03/20231/04/20231/05/20231/06/20231/07/20231/08/20231/09/20231/10/20231/11/20231/12/2023
171001501800017000200002100022000220001900018000170002000023000110001636.666667
Old New
Cell Formulas
RangeFormula
O17O17=SUM(C17:N17/IF(TRANSPOSE(B2:B13)=A16,A17,B17))
 
Upvote 0

Forum statistics

Threads
1,215,769
Messages
6,126,787
Members
449,336
Latest member
p17tootie

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