excelsubtotal

Excel subtotal where the reference only shown once


does someone know How I can make the Excel to provide the subtotal based on the Company?

When I try the standard subtotal then it does not give me the right subtotal.

enter image description here


Solution

  • This is what you need to do to make the SUBTOTAL feature of Excel to work:

    enter image description here


    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)


    May be not elegant or neat, but you could achieve this using Excel Formulas assuming no Excel Constraints and using MS365 then:

    enter image description here


    • Formula used in cell F2

    =LET(
         _Data, A2:D10,
         _Company, SCAN(,TAKE(_Data,,1),LAMBDA(x,y,IF(y="",x,y))),
         _Value, TAKE(_Data,,-1),
         _Sum, BYROW(_Company,LAMBDA(x, SUM((x=_Company)*_Value))),
         HSTACK(DROP(_Data,,-1),IF(_Value<>"",_Value,DROP(VSTACK("",_Sum),-1))))
    


    Note: The zeros are hidden using Custom formatting --> General;;