I am creating a net-worth calculator in Excel. I am planning to enter the bank and equity details once a week. I want to know the change in my portfolio compared to the last entry using a function. I can write a VBA code to search for the previous value for a particular category but I want to know if XLookup or something else can help me.
I want a formula for column Diff. I tried the below formula but it gives me the first or the current matching row and I need the previous one.
=XLOOKUP(E42;E:E;I:I;;;-1)


E:EandI:I. You want a mixed reference likeE$2:E2that expands as you drag down.=MAP(B2:B7,E2:E7,LAMBDA(α,δ, IFERROR(δ-XLOOKUP(α,DROP(B2:α,-1),DROP(E2:δ,-1),,,-1),0)))