Home » excel » excel – How to find the nth last non-empty cell in a row, on another worksheet

excel – How to find the nth last non-empty cell in a row, on another worksheet

Posted by: admin May 14, 2020 Leave a comment

Questions:

I need to find the third last non-empty cell in a row, on another worksheet, and return its value in the current cell. I am able to obtain the second last non-empty value, but not the third last.

I have tried using offset, index and lookup as shown below.

'Attempt 1
=(INDEX('Ontario - Monthly'!3:3,MATCH(9^99,'Ontario - Monthly'!3:3)))

'Attempt 2
=LOOKUP(2,1/(('Ontario - Monthly'!AO3:NH3<>"")),'Ontario -Monthly'!AN3:NH3)

'Attempt 3
=OFFSET('Ontario - Monthly'!AN3,'Ontario - Monthly'!AN3:XFD3-3,1)
How to&Answers:
=INDEX(Sheet2!1:1,AGGREGATE(14,6,1/(LEN(Sheet2!1:1)>0)*COLUMN(Sheet2!1:1),3))
                                                                          ^

Change the 3 to n if you want a different nth last

enter image description here