Hi kc27315,
Here's a UDF I wrote to do the job:
Function LastVal(rng As Range, val As Integer) As Currency
'This UDF displays the last (visible) value in an adjacent right column based on _
the last val and blank cell in a selected column. _
Note that it could be easily modified to simply work on a selected column.
For Each Cell In rng
If Cell.Value = val And Cell.Offset(1, 0) = "" Then
LastVal = Cell.Offset(, 1).Value
Exit For
End If
Next Cell
End Function
Forgive me if you already know how to do this, but the following five steps will put the code into a module that you can then run the function from:
1. Copy (Ctrl + C) my code
2. Open the VBA editor (Alt + F11)
3. From the Insert menu click Module
4. Paste (Ctrl + V) my code from step 1 above into the blank module
5. From the File menu click Close and Return to Microsoft Excel
Then use the UDF as you would any other native excel formula - i.e. =LastVal(A1:A26,1)
HTH
Robert
Bookmarks