Hi. So I just recently learned about the LOOKUP formula and it's use for finding the last non blank cell in a range.
For reference, I was looking at this explanation: https://exceljet.net/formula/get-value-of-last-non-empty-cell
So the formula that's returning the last non blank cell:
=LOOKUP(2,1/(F8:W8<>0),F8:W8)
My understanding is that because LOOKUP assumes an ascending order, when it can't find the value 2 it looks for the next lesser value, which means it's going to look from the end (assumed to be the greatest) to the beginning (assumed to be the least). I get that the logic behind how it's parsing the array and checking each element against a condition doesn't necessarily *have* to go from the greatest to the least, but allegedly that's what's happening here and is the reason that although *all* non-blank elements in the array are 1, it's going to find the last one).
But here's the thing, it's also the case that =LOOKUP(1,1/(F8:W8<>0),F8:W8) *also* returns the last non-blank element even though there is an *exact* match it could have returned earlier.
From this it *seems* that the behavior is to run the array element check against the condition from the end to the beginning for *all* cases, not just when there isn't an exact match.
Is this true? Does anyone know? Seems to me that if it is true, MS should just come out and explicitly say that somewhere. Indeed, in the link they explain that they deliberately chose a value that was greater than 1 because they seemed to think this would invoke the "start from the end and work backward" behavior, even though a value greater than 1 seems not to be necessary (1 itself will do fine).
Thanks
For reference, I was looking at this explanation: https://exceljet.net/formula/get-value-of-last-non-empty-cell
So the formula that's returning the last non blank cell:
=LOOKUP(2,1/(F8:W8<>0),F8:W8)
My understanding is that because LOOKUP assumes an ascending order, when it can't find the value 2 it looks for the next lesser value, which means it's going to look from the end (assumed to be the greatest) to the beginning (assumed to be the least). I get that the logic behind how it's parsing the array and checking each element against a condition doesn't necessarily *have* to go from the greatest to the least, but allegedly that's what's happening here and is the reason that although *all* non-blank elements in the array are 1, it's going to find the last one).
But here's the thing, it's also the case that =LOOKUP(1,1/(F8:W8<>0),F8:W8) *also* returns the last non-blank element even though there is an *exact* match it could have returned earlier.
From this it *seems* that the behavior is to run the array element check against the condition from the end to the beginning for *all* cases, not just when there isn't an exact match.
Is this true? Does anyone know? Seems to me that if it is true, MS should just come out and explicitly say that somewhere. Indeed, in the link they explain that they deliberately chose a value that was greater than 1 because they seemed to think this would invoke the "start from the end and work backward" behavior, even though a value greater than 1 seems not to be necessary (1 itself will do fine).
Thanks