For every similar column C add the first value from column B in column G

NessPJ

Active Member
Joined
May 10, 2011
Messages
422
Office Version
  1. 365
Hi guys,

I'm trying to figure out if i can have a formula that will put the first value from column B in column G for every similar value in column C.

I have a file with testdata uploaded here: https://www.dropbox.com/s/cehp2rmi5ao5tta/Testfile01.xlsx?dl=0

So basically the column Route (C) has several values "101". For every one of those values i would like Column G to contain the value "23" (which is the first value to come across in the table for Route 101).

Is this possible? :)
 
Last edited:
Yup, just record a macro whilst you do it manually :)

That is actually pretty efficient. :)

ActiveSheet.Range("$A$1:$L$3086").RemoveDuplicates Columns:=Array(4, 5), _
Header:=xlYes

Can you confirm that with "Columns:=Array(4, 5)," Only duplicates from Column 4 of every duplicate value within Column 5 are removed? :)
 
Upvote 0

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
That will delete any row where the values in both cols D & E are duplicated.
So in this example the green row will be deleted, but the blue row wont.


Excel 2013/2016
ABCDE
1KeySequenceDayBlockRoute
232441323111000105
33243214111645105
412342314112200105
521343214111002105
623141234111100102
721342341111101102
81234321111000102
912343214111001112
1023141234211007112
1112342134113107112
1223141234213107112
1332141234113107105
1412341234211245108
1523142134112201108
Sheet1
 
Upvote 0
I can not seem to catch a break today.

If i try to incorporate my duplicate check, i keep getting Type Mismatch errors.
I am probably doing something while trying to check if my value is "J" or "j" but i can't figure out what it is.
What am i doing wrong? :)

Code:
    Dim SKIP2deLEV As Boolean
    Dim CHK2deLEV As Variant
    
    CHK2deLEV = Sheets("Par").Range("B38").Value
    
    If CHK2deLEV Is Empty Then
        SKIP2deLEV = True
    End If
    
    If Not CHK2deLEV Is "J" Or "j" Then
        SKIP2deLEV = True
    End If
    
    If Not SKIP2deLEV = True Then
        ActiveSheet.Range("$A$3:$M$" & LastRowATImpTable).RemoveDuplicates Columns:=Array(4, 5), _
        Header:=xlYes
    End If
 
Upvote 0
Try
Code:
   Dim SKIP2deLEV As Boolean
   Dim CHK2deLEV As Variant
   
   CHK2deLEV = Sheets("Par").Range("B38").Value
   
   If CHK2deLEV = "" Or LCase(CHK2deLEV) = "j" Then
      SKIP2deLEV = True
   End If
   If Not SKIP2deLEV = True Then
      ActiveSheet.Range("$A$3:$M$" & LastRowATImpTable).RemoveDuplicates Columns:=Array(4, 5), _
      Header:=xlYes
   End If
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,326
Members
452,635
Latest member
laura12345

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