VBA/Formula to only run lookup if a cells value is a match

Benjo83

New Member
Joined
Nov 6, 2023
Messages
3
Office Version
  1. 365
Platform
  1. Windows
Hi all,

I'm building a report that is automated through VBA (by button clicks to call certain macros). One of the requirements is that specific region data be exportable into a new workbook (again, automated through VBA).

However, as a result of this requirement I am trying to work out the best way to retrieve any updates made to the exported workbooks (there will be 7 in total). The complication here is that I would not want for the updates to overwrite anything that doesn't match the region (stored in column B).

These edited exports will be added back in to the master file as sheets with set names (will not change ever).

My initial thinking was to add a conditional "IF" statement to only run the vlookup IF the contents of B4 (4 being the first line of data) are an exact match, else it should ignore the row and move to the next. However, I'm not sure if this is possible.

For information (and in the absence of having trial code to share):
Column A contains a unique ID to be looked up against
Column B contains the region name - so will allow for exact string matching
Columns C-V contain data that will remain unchanged
Column W-AQ contain the editable data and would be the cells requiring the results of any lookup

Let me know if there is any more info I can share to help get to the bottom of this.

Thanks

Ben
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.

Forum statistics

Threads
1,223,929
Messages
6,175,460
Members
452,644
Latest member
gjcase

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