Getting the last non-empty cell in a row

2019-03-18 14:46发布

I am having a lot of difficulty trying to come up with a way to 'parse' and 'order' my excel spreadsheet. What I essentially need to do is get the last non empty cell from every row and cut / paste it a new column.

I was wondering if there is an easy way to do this?

I appreciate any advice. Many thanks in advance!

3条回答
疯言疯语
2楼-- · 2019-03-18 15:24

You can also use OFFSET. You don't need to specify an ending column, you can just reference the entire row.

=OFFSET(1:1,0,COUNTA(1:1)-1,1,1)
查看更多
Animai°情兽
3楼-- · 2019-03-18 15:30

Okay, from what you've given if I understood correctly, you can use this formula in cell J1 and drag it down for the other rows below this cell:

=INDEX(A1:I1,1,COUNTA(A1:I1))

This assumes that the 'longest row' goes up to the column I.

查看更多
不美不萌又怎样
4楼-- · 2019-03-18 15:45

Are your values numeric or text (or possibly both)?

For numbers get last value with this formula in Z2

=LOOKUP(9.99E+307,A2:Y2)

or for text....

=LOOKUP("zzz",A2:Y2)

or for either...

=LOOKUP(2,1/(A2:Y2<>""),A2:Y2)

all the formulas work whether you have blanks in the data or not......

查看更多
登录 后发表回答