Automatic cell references based on similar text values in adjacent column

CatalysTim

New Member
Joined
Jul 21, 2015
Messages
3
Hi,

I have a large database resembling the image below, with instances of similar text values in one column and a corresponding numerical column next to it. I am trying to modify the numerical column such that when I edit one numerical cell, all cells in the same column with similar (not identical) adjacent text values inherit the same value (e.g. green cells). The challenges are:

  1. Similar text values = contains same starting phrase (e.g. Apple - Green is matched with Apple - Green and Big, but not Apple - Red)
  2. I can't use color coding for the numerical column per the image below, because the spreadsheet is already color coded for other purposes.

I've thought of creating a separate worksheet that would automatically populate itself with text values (in alphabetical order) from the equivalent of Column B in the main database worksheet. The second worksheet would then contain user-inputted numerical cells, to which the numerical cells in the main database worksheet would refer.

Any advise on creating a solution for this would be greatly appreciated.


Screen_Shot_2015_07_22_at_2_44_50_PM.png
 
Last edited:

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
CatalysTim,
I would create "Common Identifier" column (lets say column D in your sample above) and put numbers in that column... so...
Seller Item Price Unique Identifier


Seller Item Price Unique Identifier
AA Apple - Green 1
BB Orange - Big 2
CC Apple - Green and Big 1
DD Apple - Red 3
EE Banana - Yellow 4
FF Orange 2
GG Banana - Big and Yellow 4









Then add code to the sheet on change event to check for the unique identifier....

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim identifier As Integer
Dim identifierRange As Range
Dim lastRange As Range

If Target.Column = 3 Then
    Application.EnableEvents = False
    Set identifierRange = Sheet1.Range("D2:D" & Sheet1.UsedRange.Rows.Count)
    identifier = Target.Offset(0, 1)
    Set lastRange = Sheet1.Range("D2")
    Do
        identifierRange.Find(what:=identifier, after:=lastRange, lookat:=xlWhole).Offset(0, -1) = Target
        Set lastRange = identifierRange.Find(what:=identifier, after:=lastRange, lookat:=xlWhole, searchdirection:=xlNext)
    Loop Until identifierRange.Find(what:=identifier, after:=lastRange, lookat:=xlWhole).Address = Target.Offset(0, 1).Address
    Application.EnableEvents = True
End If
    

 

End Sub

Good luck,

CN.
 
Upvote 0

Forum statistics

Threads
1,215,444
Messages
6,124,892
Members
449,194
Latest member
JayEggleton

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