Change Update Text Value in column B matching column A

cspaid

New Member
Joined
Feb 26, 2019
Messages
2
Column A has a list of repeating items and column B is a Yes/No field. In the example below I want to update Fork from No to Yes and then I want all other copies of Fork to automatically update to Yes. This seems like it should be easy but I am just not seeing the correct solution.

AB
1WidgetsComplete
2ForkNo
3SpoonYes
4KnifeNo
5SpoonYes
6ForkNo
7ForkNo
8SpoonYes
9KnifeNo

<tbody>
</tbody>
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Welcome to the Board!

There are a few ways to do this. To update everything "as-is", if all your values in column B and hard-coded and not formulas, then it would probably require VBA.

Otherwise, I would recommend the following structure change.
Create a "master" table that lists east Widget type exactly once, and has the Complete button. So, any changes you make would be to this "master" table.
Then, in your data table above, use VLOOKUP formulas to look up the Complete value for the accompanying widget from your "master" table.
Then any changes you make to the "master" table will automatically be reflected in all the appropriate detailed records.

If you are unfamiliar with VLOOKUP, see the following: https://www.ablebits.com/office-addins-blog/2014/07/17/excel-vlookup-tutorial-beginner/
 
Upvote 0
Copy and paste this macro into the worksheet code module. Do the following: right click the tab name for your sheet and click 'View Code'. Paste the macro into the empty code window that opens up. Close the code window to return to your sheet. Change any cell in column B and exit the cell.

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Intersect(Target, Range("B:B")) Is Nothing Then Exit Sub
    Application.EnableEvents = False
    Dim val As Range, sAddr As String
    On Error GoTo errHandler
    Set val = Range("A:A").Find(Target.Offset(0, -1).Value, LookIn:=xlValues, lookat:=xlWhole)
    If Not val Is Nothing Then
        sAddr = val.Address
        Do
            val.Offset(0, 1) = Target
            Set val = Range("A:A").Find(What:=Target.Offset(0, -1).Value, after:=val, LookIn:=xlFormulas, lookat:=xlPart, _
                SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=True)
        Loop While val.Address <> sAddr
        sAddr = ""
    End If
errHandler:
    Application.EnableEvents = True
End Sub
 
Upvote 0
Yes, the two columns are static. Thanks all for your input! I will look into the Master Table idea first but it is good to have the VBA option!
 
Upvote 0

Forum statistics

Threads
1,216,109
Messages
6,128,884
Members
449,477
Latest member
panjongshing

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