Formula to Retrieve uniqueID row Above

GreyFox8991

New Member
Joined
Jul 20, 2022
Messages
23
Office Version
  1. 2016
Platform
  1. Windows
Greetings Excel Community,

I have some data that returns from the result of VBA code however, for each UniqueID, it returns with the value "=R[-1]C"... What I am attempting is to convert the "R[-1]C" into the respective UniqueID through a formula if possible or if there is some VBA that can be created for the exercise. I would like the end result to be the UniqueID listed for each of the reference style "R[-1]C" notations. For Example, ID 12345678 should be listed 14 times in Column A. An example is listed below.... Any insight would be greatly appreciated.

Book10
AB
1UniqueIDDate
21234567801/28/2022
3=R[-1]C03/28/2022
4=R[-1]C02/28/2022
5=R[-1]C03/30/2022
6=R[-1]C04/01/2022
7=R[-1]C04/29/2022
8=R[-1]C05/29/2022
9=R[-1]C06/29/2022
10=R[-1]C07/29/2022
11=R[-1]C08/29/2022
12=R[-1]C09/29/2022
13=R[-1]C09/30/2022
14=R[-1]C10/29/2022
15=R[-1]C11/28/2022
16=R[-1]C12/28/2022
179101112301/28/2022
18=R[-1]C03/07/2022
19=R[-1]C02/28/2022
20=R[-1]C03/28/2022
21=R[-1]C03/30/2022
22=R[-1]C04/29/2022
23=R[-1]C05/29/2022
24=R[-1]C06/29/2022
25=R[-1]C07/29/2022
26=R[-1]C08/17/2022
27=R[-1]C08/29/2022
28=R[-1]C09/29/2022
29=R[-1]C10/29/2022
30=R[-1]C11/28/2022
31=R[-1]C12/28/2022
Sheet1
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Hi GreyFox8991,

Try this:

VBA Code:
Option Explicit
Sub Macro1()

    Dim wsSrc As Worksheet
    Dim i As Long, j As Long, k As Long
    
    Application.ScreenUpdating = False
    
    Set wsSrc = ThisWorkbook.Sheets("Sheet1") '<-Sheet name containing the data. Change to suit if necessary.
    j = 2
    k = wsSrc.Range("A:B").Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
    
    For i = j To k
        If Len(wsSrc.Range("A" & i)) = 0 Or wsSrc.Range("A" & i).HasFormula = True Then
            wsSrc.Range("A" & i).Formula = "=R[-1]C"
        End If
    Next i
    
    Application.ScreenUpdating = True
    
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,815
Messages
6,181,135
Members
453,021
Latest member
Justyna P

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