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.
 
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.
Ok, thanks, I will try it.

However, as is, I am getting a system message that the formula is incorrect? #14
 
Upvote 0

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Ok, thanks, I will try it.

However, as is, I am getting a system message that the formula is incorrect? #14
Hi there, here goes. Entered it is B2

1733223966363.png
 
Upvote 0
Works just fine for me:

1733238175194.png


Formula in cell B2 (and copied down for all rows).
Excel Formula:
=IF(RIGHT(RC[-1],1)="5",R[-1]C[-1],"Nothing")

I don't see how you could get the results you are showing.

How is column B formatted?
Is it formatted as "General"?

And do you have any VBA in this workbook?
 
Upvote 0
Works just fine for me:

View attachment 119979

Formula in cell B2 (and copied down for all rows).
Excel Formula:
=IF(RIGHT(RC[-1],1)="5",R[-1]C[-1],"Nothing")

I don't see how you could get the results you are showing.

How is column B formatted?
Is it formatted as "General"? YES

And do you have any VBA in this workbook? NO
 
Upvote 0
If you set up your simple example from post 22 above in a brand new Excel workbook, and add the formula shown in post 23, what do those results look like?
 
Upvote 0
So the third column takes formulae.
Select Column 3 and right click. Click on "Copy"
Now select Column 2, right click, select "Paste Special" and click on the "Format" radio button to select it. Click on OK.
Does that make Column2 accept formulae?

If not, use "DropBox" or a similar site to upload your workbook into so someone can have a look at it.
Make sure that personal data is changed before doing that.
 
Upvote 0
So the third column takes formulae.
Select Column 3 and right click. Click on "Copy"
Now select Column 2, right click, select "Paste Special" and click on the "Format" radio button to select it. Click on OK.
Does that make Column2 accept formulae?

If not, use "DropBox" or a similar site to upload your workbook into so someone can have a look at it.
Make sure that personal data is changed before doing that.
Column 2 takes formulae as well, the Len fn was there first and i just inserted a new column to include the IF fn.
Will do what you suggest, thanks.

1733296425774.png
 
Upvote 0

Forum statistics

Threads
1,224,620
Messages
6,179,925
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