Create total row below table and make the total row expand or contract

bearcub

Well-known Member
Joined
May 18, 2005
Messages
731
Office Version
  1. 365
  2. 2013
  3. 2010
  4. 2007
Platform
  1. Windows
I am using the following 2 formulas to create a table that summarizes commissions that are being paid. I would like make the table dynamic so I do have a number of blank rows below the data. Right now I have to insert blank rows to account an expanding table.

Also, I am getting a weird Total Value after the last table row.

I am using the unique function to spill the people being paid this month and the following formula to add all the orders that should be paid to them

List all the people being paid this month:
IF(UNIQUE(Table6[Rep Name])="","",UNIQUE(Table6[Rep Name]))

Add all the orders on this sheets:
BYROW(Q6#,LAMBDA(r,SUMIF(A:A,r,B:B)))

Is there a way to create a formula that perform both of these and create a dynamic "Total" row that expands and contracts with the # of people being paid:

Here is the table that I am referring to in column P & Q. The third column is reconcile the names on the summary sheet going to payroll.

1721167001502.png
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
I don't know what your worksheet actually looks like, but you can do something like this:

Book2
ABCDE
1NameAmtNameAmt
2Aaron1Aaron10
3Bob2Bob11
4Aaron3Corey4
5Corey4David12
6David5Ian18
7Aaron6
8David7TOTAL55
9Ian8
10Bob9
11Ian10
12
Sheet2
Cell Formulas
RangeFormula
D2:E8D2=LET(t,SORT(UNIQUE(FILTER(A2:A20,A2:A20<>""))),s,SUMIF(A:A,t,B:B),r,ROWS(t),sq,SEQUENCE(r+2),CHOOSE({1,2},IFS(sq<=r,t,sq=r+1,"",1,"TOTAL"),IFS(sq<=r,s,sq=r+1,"",1,SUM(s))))
Dynamic array formulas.
 
Upvote 0
Solution
That you, that'll work. The formula did create Calc# error in the column that is pulling from the summary sheet. Once I change the # to a number the formula worked fine.

For some reason,

BYROW(Q6#, LAMBDA(r, SUMIF(A:A, r, B:B)))

caused a CALC# error which I thought was odd. I think it had to do with Q6#, once I converted it to a number range the formula worked. Is there any to make this formula dynamic?

BYROW(Q6#,LAMBDA(r,SUMIF('Comm_June 24 US Summary'!F:F,r,'Comm_June 24 US Summary'!I:I)))

1721188883112.png
 

Attachments

  • 1721188764437.png
    1721188764437.png
    106.5 KB · Views: 8
  • 1721188830674.png
    1721188830674.png
    36.1 KB · Views: 8
Upvote 0
Sorry, my version of Excel doesn't have BYROW, so I can't troubleshoot it. But if I understand it correctly, then this:

Excel Formula:
BYROW(Q6#, LAMBDA(r, SUMIF(A:A, r, B:B)))

is equivalent to this:

Excel Formula:
=SUMIF(A:A,Q6#,B:B)

assuming Q6# is a 1-column range.
 
Upvote 0
That is good to know, thank you. However, when I do that I get a spill error because the array formula in column P is referencing 2 columns. I think I can live with having to update the range manually.
 
Upvote 0

Forum statistics

Threads
1,220,965
Messages
6,157,119
Members
451,398
Latest member
rjsteward

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