Forum Discussion
Formula help needed
Assuming that your master file tab is named "Master" and the second tab is named "OtherTab," follow these steps:
- In cell B1 of "OtherTab," enter the following formula:
=IF(Master!A1="Palo Alto", 2, IF(Master!A1="THV-PA", 0, ""))
Replace "Master" with the actual name of your master file tab.
Method 2: VBA Macro
If you want a more automated solution, you can use a VBA macro. Here's how you can set it up:
- Press Alt + F11 to open the VBA editor.
- In the VBA editor, go to Insert -> Module to add a new module.
- Copy and paste the following VBA code into the module:
Vba code is untested, please backup before your try this code.
Sub UpdateOtherTab()
Dim masterValue As String
Dim otherTab As Worksheet
' Replace "Master" with the actual name of your master file tab
Set otherTab = ThisWorkbook.Sheets("OtherTab")
' Get the value from Master!A1
masterValue = Sheets("Master").Range("A1").Value
' Update B1 in OtherTab based on the condition
If masterValue = "Palo Alto" Then
otherTab.Range("B1").Value = 2
ElseIf masterValue = "THV-PA" Then
otherTab.Range("B1").Value = 0
End If
End Sub4. Close the VBA editor.
Now, whenever you want to update the value in "OtherTab!B1" based on the value in "Master!A1," you can run this macro:
- Press Alt + F8 to open the "Macro" dialog.
- Select UpdateOtherTab and click "Run."
Choose the method that best fits your needs — whether you prefer a formula-driven approach or a VBA macro. The text and steps were edited with the help of AI.
My answers are voluntary and without guarantee!
Hope this will help you.
Was the answer useful? Mark as best response and Like it!
This will help all forum participants.