Dynamically sum a row after each row entry has been multiplied by a two way lookup.

PrettyGood_Not Great

Board Regular
Joined
Nov 24, 2023
Messages
95
Office Version
  1. 365
Platform
  1. Windows
My challenge is to take the sum of each row in the data table (large table on right), after each row entry has been multiplied by a two-way lookup to the rate table (small table on left). I have tried working with SUMPRODUCT without success. I have the two way lookup working with a double XLOOKUP but cannot get it to span the range of the entire row to work within the SUMPRODUCT. I need the sum of the entire row in one cell (SUM Result), and the ability to pull it down. Note that none of these ranges have the same dimensions. The data table with the Sum Result is approx. 1000 rows deep. A 365 solution would be ideal, however 2016 techniques are still welcomed.

1703778123898.png
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Maybe like
Excel Formula:
=REDUCE(0,I2:Z2,LAMBDA(a,b,a+b*your lookup formula))
 
Upvote 0
Maybe like
Excel Formula:
=REDUCE(0,I2:Z2,LAMBDA(a,b,a+b*your lookup formula))
Hi Fluff, I am having trouble with the LAMBDA. I am new to it an not quite sure what you had in mind. I have added a mini sheet that contains the double XLOOKUP to the rate table into columnH. I have also attempted your formula in H2. Could you help further please?

book1.xlsm
ABCDEFGHIJKLMNOPQRSTUVWX
1RateCode20232024202520262027SUM ResultSkill/RateJan-24Feb-24Mar-24Apr-24May-24Jun-24Jul-24Aug-24Sep-24Oct-24Nov-24Dec-24Jan-25Feb-25Mar-25
2R1186.9192.5198.3204.2210.3#VALUE!A1R1108120150114114138757590717575687547
3R2131.9135.9139.9144.1148.5135.9B1R281120150114114138757590717575687547
4R3106.0109.2112.4115.8119.3109.2C1R3414556434352454554434545414528
5R482.184.587.189.792.484.5D1R468759471718675759071757568750
6R547.348.750.151.653.248.7E1R561688464647868688164686861680
Sheet1
Cell Formulas
RangeFormula
H2H2=REDUCE(0,I2:X2,LAMBDA(XLOOKUP(RIGHT($I2,2),$A$2:$A$6,XLOOKUP(YEAR(J$1),$B$1:$F$1,$B$2:$F$6))))
H3:H6H3=XLOOKUP(RIGHT($I3,2),$A$2:$A$6,XLOOKUP(YEAR(J$1),$B$1:$F$1,$B$2:$F$6))
 
Last edited by a moderator:
Upvote 0
Thanks for that, how about
Fluff.xlsm
ABCDEFGHIJKLMNOPQRSTUVWX
1RateCode20232024202520262027SUM ResultSkill/Rate01/01/202401/02/202401/03/202401/04/202401/05/202401/06/202401/07/202401/08/202401/09/202401/10/202401/11/202401/12/202401/01/202501/02/202501/03/2025
2R1186.88192.4864198.261204.2088210.3351269685.154A1R1108.04355120.04839150.06048114.04597114.04597138.0556575.04838775.04838790.05806571.29596875.04838775.04838767.54354875.04838746.935484
3R2131.9135.857139.9327144.1307148.4546186573.267B1R28112015011411413875759071.25757567.57546.875
4R3105.99109.1697112.4448115.8181119.292773516.2472C1R340.5362945.04032356.30040342.78830642.78830651.79637145.04032345.04032354.04838742.78830645.04032345.04032340.5362945.04032328.175403
5R482.0884.542487.0786789.6910392.3817690737.3732D1R467.51451675.01612993.77016171.26532371.26532386.26854875.01612975.01612990.01935571.26532375.01612975.01612967.51451675.0161290.0201613
6R547.2548.667550.1275351.6313553.1802947005.4203E1R560.75725867.50806584.38508164.13266164.13266177.63427467.50806567.50806581.00967764.13266167.50806567.50806560.75725867.5080650.0100806
Data
Cell Formulas
RangeFormula
H2:H6H2=SUM(MAP($J$1:$X$1,J2:X2,LAMBDA(a,b,b*XLOOKUP(RIGHT($I2,2),$A$2:$A$6,XLOOKUP(YEAR(a),$B$1:$F$1,$B$2:$F$6)))))
 
Upvote 0
=SUM(MAP($J$1:$X$1,J2:X2,LAMBDA(a,b,b*XLOOKUP(RIGHT($I2,2),$A$2:$A$6,XLOOKUP(YEAR(a),$B$1:$F$1,$B$2:$F$6)))))
ok Nice, this is excellent thank you! I am having one issue with it though. In the real workbook the last cell in the row header for the dates (X1) is blank due to it not having data to return. This equation, along with all the other attempts I`ve made returns #VALUE if the equation references the full row (J1:X1). If I back off the row arrays to stop at the visible data (J1:W1) then they all work. How can I handle this error? Note that the Date Header is a spilled array formula, maybe that is the issue? It is important to have this error handling as the duration of the project can change at any time, thus requiring some extra columns in the header row to handle the increased duration.
 
Upvote 0
How about
Excel Formula:
=SUM(MAP($J$1:$X$1,J2:X2,LAMBDA(a,b,IF(a="",0,b*XLOOKUP(RIGHT($I2,2),$A$2:$A$6,XLOOKUP(YEAR(a),$B$1:$F$1,$B$2:$F$6))))))
 
Upvote 1
How about
Excel Formula:
=SUM(MAP($J$1:$X$1,J2:X2,LAMBDA(a,b,IF(a="",0,b*XLOOKUP(RIGHT($I2,2),$A$2:$A$6,XLOOKUP(YEAR(a),$B$1:$F$1,$B$2:$F$6))))))
Nice! Thank you Fluff!

I have another related challenge, and that would be to do the same for the columns (sum of column after application of rate lookup, located above date header row), but this time I`d like it to be a dynamic subtotal when I filter on Charge codes (column H). Would you be interested in this? or shall I start another post?
 
Upvote 0
As this is a totally different question it needs a new thread. Thanks
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,772
Members
452,353
Latest member
strainu

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