Search code examples
google-sheetssumifs

How do i fix the value of sumifs in Google sheets when i add more rows in the bottom?


enter image description here

I would need the amount available for each code based on the country and maximum available limit is 12400. But when i try to execute it the values in D3, D6 and D7 are changing as we keep on adding the rows but this is how i basically need it D3 should be 11,166 (12400-1234) D6 should be 4623 (11,166-6543) D7 should be -60,809 (4623-65432)

Can you please help me with a formula which would make my life easy


Solution

  • Try this formula out in cell D3 of your sample data

    =MAP(A3:A,B3:B,LAMBDA(ax,bx,IF(ax="",,12400-SUM(FILTER(C3:C,A3:A=ax,B3:B=bx,ROW(A3:A)<=ROW(ax))))))

    -

    enter image description here