last non-blank cell, column to left

orsm6

Active Member
Joined
Oct 3, 2012
Messages
496
Office Version
  1. 365
Platform
  1. Windows
Hi everyone. could someone help me please with a formula? trying to get last non-blank cell in column B then look left to column A and return value of next row down.

so if B20 was last non-blank cell, would like to return value in A21.

TIA.
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Try:
=INDEX(A:A,MATCH(LOOKUP(2,1/(B:B<>""),A:A),A:A,0)+1)
 
Upvote 0
Since you didn't indicate where the result should go, I have put it in a message box.

VBA Code:
Option Explicit

Sub Orsm()
    Dim lr As Long, ans
    lr = Range("B" & Rows.Count).End(xlUp).Row
    ans = Range("B" & lr).Offset(1, -1)
    MsgBox (ans)

End Sub
 
Upvote 0
Since you didn't indicate where the result should go, I have put it in a message box.

VBA Code:
Option Explicit

Sub Orsm()
    Dim lr As Long, ans
    lr = Range("B" & Rows.Count).End(xlUp).Row
    ans = Range("B" & lr).Offset(1, -1)
    MsgBox (ans)

End Sub

Hi Alan - thanks for the reply, needed a formula not a VBA.

cheers.
 
Upvote 0

Forum statistics

Threads
1,214,652
Messages
6,120,746
Members
448,989
Latest member
mariah3

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