Value of last cell in range

Dutch1956

Board Regular
Joined
Sep 14, 2010
Messages
80
hi All,

how can I return the last value in a range?
ABCDEFGHIJKLMN
112151720498
236812161936

<tbody>
</tbody>
Based on the above, I would like to return the values in D1, J1, E2and L2.
Using =LOOKUP(9.99E+307,H30:U30) will only return the value of J8.
I am looking for a formula that will return both.
Thanks for you help.

Bert
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
I don't know about a formula but this will do it.

Runs from row1 column1 to row 30 column 21 (U30) with result in column V

Code:
Sub k1()
For i = 1 To 30
k = ""
For j = 1 To 21
If Cells(i, j) <> "" And Cells(i, j + 1) = "" Then k = k & Cells(i, j) & ", "
Next j
If k <> "" Then k = Left(k, Len(k) - 2)
Cells(i, 22) = k
Next i
End Sub
 
Upvote 0
Thanks for the quick response. Your macro works perfect but I prefer to have formula so that the user do not have to run the macro every time the data changes. Also, the result of the macro put both values in one cell, like 20,8 or 8,36. I would like the result in separate cells.

Bert.
 
Upvote 0
In M1 copied down:

=INDEX(A1:K1,MATCH(1,INDEX(ISNUMBER(A1:K1)*(B1:L1=""),),FALSE))

and in N1 copied down:

=LOOKUP(9.99999999999999E+307,A1:L1)
 
Upvote 0
Hi Andrew,

once again you helped me out again. Your formula is exactly what I was looking for. Thank you so much.

Bert.
 
Upvote 0

Forum statistics

Threads
1,215,124
Messages
6,123,187
Members
449,090
Latest member
bes000

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top