Finding the value of a cell above a cell that meets a condition in a column

rufuxinix

Board Regular
Joined
Jan 23, 2019
Messages
58
Office Version
  1. 2019
Platform
  1. Windows
In an Excel column I need to find the value of a cell that is immediately above.
Example: If I have cell values that end in 5, I want to extract the value of the cell above them.
 
Leading spaces? Is the result of
Excel Formula:
=Len(A2)
what it should be (the total of the visible characters)?
 
Upvote 0

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
I get no result at all. I think I might be doing something wrong.
Thank you for this. However, it doesn't seem to.work. What am I doing wrong?

15=IF(RIGHT(RC[-1], 1) = "5", R[-1]C[-1], "Nothing")
6
15
7
14
15
5
6
8
3
1
5
 
Upvote 0
I get no result at all. I think I might be doing something wrong.
1733079217557.png


Thanks for the input. I tried, as above, no result, system message displays.
Column is Number format, not sure what else to check.

1733079368030.png
 
Upvote 0
I assume that your formulae go into Column B. The cells should not be formatted as text wherever the formulae go.
Format Column B as "General" and type in the formula in B2.
 
Upvote 0
I assume that your formulae go into Column B. The cells should not be formatted as text wherever the formulae go.
Format Column B as "General" and type in the formula in B2.
I did that, no difference.
 
Upvote 0
Did you try Post #11

Physically count the visible characters and somewhere where you are sure you can enter a formula the "Len" formula.



If you want to, you can check with a macro also.
Code:
Sub Count_Characters()
Dim i As Long
    For i = 1 To Cells(Rows.Count, 1).End(xlUp).Row
        MsgBox "Cell " & Cells(i, 1).Address(0, 0) & " has " & Len(Cells(i, 1)) & " characters!" & vbLf & _
        Asc(Right(Cells(i, 1).Value, 1)) & "  (This should be 53 if the last characters is a 5!)"
    Next i
End Sub

It looks like your cells are not formatted the way they should be. The formula shows as text.
 
Upvote 0

Forum statistics

Threads
1,224,620
Messages
6,179,927
Members
452,949
Latest member
beartooth91

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