Search code examples
google-sheetscountlimitoffsetgoogle-query-language

Google sheets copy drag formula


enter image description here enter image description here

How do I copy purple numbers from the right side when using a copy-drag? What should be the formula for it to work?


Solution

  • B2 will be:

    =K1
    

    and for every next cell use:

    =INDEX(QUERY(FLATTEN(INDIRECT("K1:O")), "Limit 1 offset "&
     SUM(COUNTIF(INDIRECT("B1:B"&ROW()-1), FLATTEN(INDIRECT("K1:O")))), ))
    

    can be dragged but since you need it in every 2nd row you can just copy-paste it wherever you need so