Index & Match with the name of Tab

ypurcaro

New Member
Joined
Mar 7, 2013
Messages
29
Hello,
I hope all is well. I don't know if we can use the index and match in this case. I tried, but I failed because I don't know how do I point the code to the name of the tab. I hope I could get some help on this one. Thank you in advance.

Table I need to fill
DateTotal HourLocation
01/02/2022120West
02/02/2022135West
03/01/2022150West
04/01/2022110West

This is the table I have all information, we call it score card. The spreadsheet has 4 tabs - East, West, North & South. The table is like below, it's more like a horizontal table. What I need to do is once I entered the hour to this table, it will also fill out the above table. Remember, this is on the tab named "West".
Date01/02/202202/02/202203/01/202204/01/202205/01/2022
Total Hour120135151110
Vacation Hour50453525
Regular Hour110907580
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
OK, let's make some guesses about how your data is laid out.
With the sample data from post #1, let's assume the first table is in the range A1:C5.
And the second table is on a sheet called "West", in the range A1:F4.
The "East" / "North" etc sheets all have an identical layout to the "West" sheet.

This formula in B2 in your first table will look at the Location in col C, and the date in col A, go to the relevant sheet, and return the Total Hours.

=OFFSET(INDIRECT(C2&"!A1"),1,MATCH(Sheet1!A2,INDIRECT(C2&"!B1:F1"),0),1,1)

Note, there may be better ways of doing this, but this does seem to work.
 
Upvote 0
OK, let's make some guesses about how your data is laid out.
With the sample data from post #1, let's assume the first table is in the range A1:C5.
And the second table is on a sheet called "West", in the range A1:F4.
The "East" / "North" etc sheets all have an identical layout to the "West" sheet.

This formula in B2 in your first table will look at the Location in col C, and the date in col A, go to the relevant sheet, and return the Total Hours.

=OFFSET(INDIRECT(C2&"!A1"),1,MATCH(Sheet1!A2,INDIRECT(C2&"!B1:F1"),0),1,1)

Note, there may be better ways of doing this, but this does seem to work.
I tried to use the code you provided and I don't understand the C2 after the indirect. Here is what I have as attached. I it gave me an error message. Thanks for your help.
 

Attachments

  • 2022-05-23_11-12-36.jpg
    2022-05-23_11-12-36.jpg
    219.9 KB · Views: 18
Upvote 0
That formula you've used in the right hand sheet in post #5 looks quite different to the one I suggested.
For example, it looks like you haven't used C2 in your formula, you've used C9.

And the layout of the left hand sheet in post #5 is completely different to the layout of the second table in post #1.
 
Upvote 0
That formula you've used in the right hand sheet in post #5 looks quite different to the one I suggested.
For example, it looks like you haven't used C2 in your formula, you've used C9.

And the layout of the left hand sheet in post #5 is completely different to the layout of the second table in post #1.
Yes, that's the actual layout. So, do I have to clean it up and re-organize the data, I mean to fill every single cell? Thank you.
 
Upvote 0
Yes, that's the actual layout
What is the actual layout ?
The layout in post #1, or the layout in post #5 ?
Just be clear about what your actual layout is please, and we can then adapt the formula to match.
 
Upvote 0
Hi - you can have whatever layout you like.

But if you present one layout, and then we suggest a solution for that layout, and then you apply that solution to a different layout, then it's possible it won't work, unless you adapt the solution to take the new layout into account.

I'll take a look at the new layout shortly.
 
Upvote 0

Forum statistics

Threads
1,223,891
Messages
6,175,229
Members
452,621
Latest member
Laura_PinksBTHFT

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