Match and copy paste values from different tabs into master sheet.

VBA learner ITG

Active Member
Joined
Apr 18, 2017
Messages
267
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
I hope everyone is having a good day :)

I was wondering if there was a formula or VBA code that you can recommend or point me in the right direction for looking at data from different tabs and populating them into the master tab.

I have summary document and in column B4 - B23 is the tab Name which has been created within VBA and within the Summary Document In Row 3, Column C through to N are months.

Tab Title (Column B)January
Audi
Ford

<tbody>
</tbody>


On each of the tabs i have the corresponding data in Column D Row 25 - 36 relating to Row 3, Column C through to N.

January£2500
February£300000
May£20000

<tbody>
</tbody>

I would like your guidance and expertise to validate by the Tab name on the Summary document and pull into the summary tab the corresponding data from each tab against the tab name.
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
just put this formula in C4 (under january right of Audi)...

Code:
=INDIRECT($B4&"!D"&COLUMN(Y1))

this will always reference sheet in column B and it will reference starting at D25 and as you drag right D25 will then go to 26, 27, etc so like transposing

i dont think your sheet name have spaces but if it does then i believe you need single quotes for the sheet name...

Code:
=INDIRECT("'"&$B4&"'!D"&COLUMN(Y1))
 
Last edited:
Upvote 0
Thank you for your assistance.

Your formula works and its definitely something i wouldn't have thought of in a million years.

I do have a final question though on the matter.

Is there a way of instead of transposing the data it can be done by looking at the month and pasting the data so it correlates.

for example if we are working on Q1 / Q2 dates like below

JuneJulyAugustSeptemberOctoberNovemberDecemberJanuaryFebruaryMarchAprilMay
2500001000002550010020070090250400220

<colgroup><col span="2"><col><col><col span="3"><col><col span="2"><col span="2"></colgroup><tbody>
</tbody>
 
Upvote 0
No prob, yeah you can do that... it looks like your formula needs to not rely on a sorted and sequential month value... so if you want it to actually check the month and return the appropriate row based on column, you perform a lookup with index-match... (assumes sheet names have no blanks)

Code:
=INDEX(INDIRECT($B4&"!D25:D36"),MATCH(C$3,INDIRECT($B4&"!C25:C36"),0))

try that
 
Last edited:
Upvote 0
Thank you for your further assistance.

The revised formula works like a charm. Thank you for making my life easier.
 
Upvote 0

Forum statistics

Threads
1,216,160
Messages
6,129,215
Members
449,493
Latest member
JablesFTW

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