This is what you need to do to make the SUBTOTAL feature of Excel to work:
To use the Subtotal feature of Excel you cannot have blanks for the Company Column. You should have got an error message stating :
Microsoft Excel cannot determine which row in your list or selection
contains column labels, which are required for this command.
If you want the first row of the selection or list used as labels and not as data, click 0K.
If you selected a subset of cells in error, select a single cell, and try the command again.
To create column labels, click Cancel, and enter a text label at the top of each column of data.
For information about creating labels that are easy to detect, click Help.
Not reinventing the process to fill down from above, you can refer this answer* on how to do it and then use the Subtotal feature.
To outline the process, I did (Just in case one cannot follow .gif)
Select the Company range till the last row --> hit ALT+H+FD+S to open the Go To Special or can follow the answer*. Click Blanks --> enter = --> click ▲ and hit CTRL+ENTER together.
Value paste the range as well.
Hit CTRL+* to select all the data
Hit ALT+A+B to open Subtotal (will again get an error pop because there are blanks --> nevermind select OK and move ahead)
Ensure --> At each change in: --> Company --> Use Function: --> SUM --> Add Subtotal to: --> Check Value --> select in below only Value --> Hit OK (Selections are as per one's preference and requirements).
Now, hit CTRL+SHIFT+L to apply filter. Select the Invoice Column and filter out blanks --> Select Company Col --> hit ALT+; to select visible cells and press DEL from your keyboard --> remove filters to get what you need.
May be not elegant or neat, but you could achieve this using Excel Formulas assuming no Excel Constraints and using MS365 then:
Using LET() function makes easier to read, eliminates redundant ranges, increases performance.
_Data variable is the source range defined.
_Company variable where SCAN() and TAKE() function is used. Using the TAKE() function grabbing the Company range. Next, using SCAN() filling all the blanks from above value. Here, the initial value is an empty string which is the [initial_value] while the one returned using TAKE() is the range which needs to be filled in, it uses a LAMBDA() helper function, where x is the [accumulator] and y is the current range. If the current cell is empty it uses x while if not empty then retains the y, keeps iterating until and unless its filled up.
_Value variable is the value columns grabbed using TAKE() function.
_Sum variable uses BYROW() function, which applies a custom LAMBDA() calculations to each row in the array and returns one output per row.
Finally, in the last step, we are doing some logical test to return values when its TRUE and FALSE respectively. DROP() function used twice, which drops the last cell from the array. While HSTACK() function is used to combine the arrays into one and stack horizontally, to return the final output.
Note: The zeros are hidden using Custom formatting --> General;;
This is what you need to do to make the
SUBTOTALfeature of Excel to work:To use the
Subtotalfeature ofExcelyou cannot have blanks for theCompanyColumn. You should have got an error message stating :Not reinventing the process to fill down from above, you can refer this answer* on how to do it and then use the
Subtotalfeature.To outline the process, I did (Just in case one cannot follow .gif)
Companyrange till the last row --> hit ALT+H+FD+S to open theGo To Specialor can follow the answer*. ClickBlanks--> enter = --> click ▲ and hit CTRL+ENTER together.Subtotal(will again get an error pop because there are blanks --> nevermind selectOKand move ahead)At each change in:-->Company-->Use Function:-->SUM-->Add Subtotal to:--> CheckValue--> select in below onlyValue--> HitOK(Selections are as per one's preference and requirements).InvoiceColumn and filter out blanks --> SelectCompanyCol --> hit ALT+; to select visible cells and press DEL from your keyboard --> remove filters to get what you need.May be not elegant or neat, but you could achieve this using
Excel Formulasassuming noExcel Constraintsand usingMS365then:• Formula used in cell F2
LET()function makes easier to read, eliminates redundant ranges, increases performance._Datavariable is the source range defined._Companyvariable whereSCAN()andTAKE()function is used. Using theTAKE()function grabbing theCompanyrange. Next, usingSCAN()filling all the blanks from above value. Here, the initial value is an empty string which is the[initial_value]while the one returned usingTAKE()is the range which needs to be filled in, it uses aLAMBDA()helper function, wherexis the[accumulator]andyis the current range. If the current cell is empty it usesxwhile if not empty then retains they, keeps iterating until and unless its filled up._Valuevariable is thevaluecolumns grabbed usingTAKE()function._Sumvariable usesBYROW()function, which applies a customLAMBDA()calculations to each row in the array and returns one output per row.TRUEandFALSErespectively.DROP()function used twice, which drops the last cell from the array. WhileHSTACK()function is used to combine the arrays into one and stack horizontally, to return the final output.Note: The
zerosare hidden usingCustom formatting-->General;;