using vlookup function in VBA

frustrated_macro

New Member
Joined
Sep 4, 2019
Messages
41
Office Version
  1. 365
Platform
  1. Windows
So i need to run a vlookup weekly this week's report against last week's report
But last weeks report will always be named differently ("Report 3.7", "Report 3.14", "Report 3.21", etc)
the columns im looking up against will always be the same but the report name is different
the tabs on both reports will also be named exactly the same ("raw, "des", "fam" hogar")
is there a way for me to do this?
for reference the data im comparing is dates, to see if from last week to this week there was any changes
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Hi there,
is there a logic in the report names? It looks like it's days? What you could do is e.g. have one cell where you can type the "reference/last week report name", e.g. "Report 3.7". In a formula, you can pick this up with an INDIRECT/ADDRESS function inside your VLOOKUP.
The steps:
  • create that cell and input your reference report name
  • create your VLOOKUP function with the current report and the previous report open
  • in the VLOOKUP, replace the "Report 3.7" part with an INDIRECT function - will take a bit of fiddling, especially with sheet/filenames be aware of single & double quotes, in Excel you can make longer strings with an & sign. So =A1&A2 will give you a string with the values of A1 and A2.
Hope that helps!
Koen
 
Upvote 0

Forum statistics

Threads
1,216,004
Messages
6,128,223
Members
449,435
Latest member
Jahmia0616

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