# of value Getting the last non-empty cell in a row

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`

.

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!

## Last non-empty cell in a column

This works with both text and numbers and doesn't care if there are blank cells, i.e., it will return the last non-blank cell.

**It needs to be array-entered**, meaning that you **press Ctrl-Shft-Enter after** you type or paste it in. The below is for column A:

```
=INDEX(A:A,MAX((A:A<>"")*(ROW(A:A))))
```

Here is another option: `=OFFSET($A$1;COUNTA(A:A)-1;0)`