Return value from previous cell conditionally

I want to return a value from a previous cell if the cell to the left of it (on the same row) is X.

enter image description here

For all rows with 115 in A column, I want to put the formula in column C, to get the value from the 1st previous cell in column B for which column A shows 20.

3

1 Answer

Here it is, for exmple for C1:

=IF(A1=115,LOOKUP(2,1/($A$1:INDIRECT(ADDRESS(ROW(A1)-1,2))=20),B:B),"")

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like