Search code examples
google-sheetsgoogle-sheets-formula

Return last value based on date with criteria on google sheets


Here are the contents of my table:

ColA= date, ColB=Code #, ColC=Whole Amt, ColD=Amt as of now, ColE=Accumulated Amt

What i want to happen is to return the value from Column D and put it in Column E based on the latest date; however, the value of ColB value should be the same.

I tried using INDEX + MATCH + MAX, but something is missing and I can't point it out.

I am sharing here the link of the sheet so you can explore. I also put some comments beside each cell as it may help. Thank you!

https://docs.google.com/spreadsheets/d/1YADVkKPNp0TmSVtz6X9EtgqAnTNTocNBWFwtQzt5okE/edit?usp=sharing


Solution

  • You may try:

    =map(B2:B,D2:D,lambda(Σ,Λ,if(Σ="",,if(countif(B1:Σ,Σ)=1,0,sumif(B1:Σ,Σ,D1:Λ)))))
    

    enter image description here