Search code examples
excelexcel-formulasubtotalvba

Place Subtotal value in all cells in group


I have a requirement where i need to enter the value of a SubTotal in each row for the corresponding group. Below is a snapshot of the subtotals in in Column Q and this value manualy entered by me in Column M. I'm happy to create a Macro to do this or a Formula, but i can not seem to think of the logic on how to achieve this. Can anyone advise please.

Many thanks

enter image description here


Solution

  • Put the following Array Formula in M5:

    =IF(A5<>"",INDEX($Q5:$Q$1000,MATCH(0,IF($A5:$A$1000="",0,1),0)),"")
    

    Press Ctrl-Shift-Enter instead of Enter or Tab to exit edit mode. Then copy down.

    enter image description here