Lookup value across multiple sheets and return sheet name

Tanianiania

Board Regular
Joined
May 3, 2012
Messages
80
Hello

I'm struggling with this one..

I need a formula that reference a value starting in $A4 and looks for it across multiple worksheets and returns the worksheet name

There are 8 worksheets in total, the value will only appear once and won't be duplicated across sheets.

Thankyou
 
The array-processing formula you are referring to:
Rich (BB code):
=INDEX(SheetList,MATCH(1,1/COUNTIFS(INDIRECT("'"&SheetList&"'!A2:A100"),$A4),0))
looks up a value that is in A4 and returns a single sheet name from SheetList where a match against A2:A100 is found.

Let A4 house a company name of interest...

In A6 control+shift+enter and copy down:
Rich (BB code):
=IFERROR(INDEX(SheetList,SMALL(IF(ISNUMBER(1/COUNTIFS(INDIRECT("'"&SheetList&"'!A2:A100"),$A$4)),
    ROW(INDIRECT("1:"&COUNTIFS(SheetList,"?*")))),ROWS($A$6:A6))),"")

Hi Aladin,

Thank you so much for this. I've tried to employ your example, on an excel file which i've created as a simpler example of what i'm trying to do.

For the benefit of other users (i'm trying to avoid uploading a file) and to explain the photos below the following is in the sheets


  • A list to look up consisting of animals that can appear in any of the subsequent sheets (potentially in all three): Dog, Cat, Dolphin, Iguana, Elephant, Tiger, Lion, Fish and Penguin. I want to return the name of the sheets these animals are found on
  • Sheet names: James Peter and Simon I want to return data from which have been named as "SheetList"
  • Potential data in cells: A1 -> A999 in those three sheets
    • James sheet: Dog, Cat, Tiger, Fish and Penguin
    • Peter: Lion, Fish, Penguin and Tiger
    • Simon: Tiger, Fish and Penguin


I don't seem to be able to get it to return all three of the names on my SheetList. "Peter" does not show at all up which is the middle of the named list

2ro6exh.png


However, what i'm ideally trying to create is shown on the image below so that the sheet names would return across a series of columns. Would this be possible?

2e3pbi1.png


Thanks so much for your help - i'm relatively new to Excel so apologies for any stupid questions (wanted to make this as helpful as possible for other people in the future)

Arch
 
Upvote 0

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Hi Aladin,

Thank you so much for this. I've tried to employ your example, on an excel file which i've created as a simpler example of what i'm trying to do.

For the benefit of other users (i'm trying to avoid uploading a file) and to explain the photos below the following is in the sheets


  • A list to look up consisting of animals that can appear in any of the subsequent sheets (potentially in all three): Dog, Cat, Dolphin, Iguana, Elephant, Tiger, Lion, Fish and Penguin. I want to return the name of the sheets these animals are found on
  • Sheet names: James Peter and Simon I want to return data from which have been named as "SheetList"
  • Potential data in cells: A1 -> A999 in those three sheets
    • James sheet: Dog, Cat, Tiger, Fish and Penguin
    • Peter: Lion, Fish, Penguin and Tiger
    • Simon: Tiger, Fish and Penguin


I don't seem to be able to get it to return all three of the names on my SheetList. "Peter" does not show at all up which is the middle of the named list

[...]

However, what i'm ideally trying to create is shown on the image below so that the sheet names would return across a series of columns. Would this be possible?

[...]

Thanks so much for your help - i'm relatively new to Excel so apologies for any stupid questions (wanted to make this as helpful as possible for other people in the future)

Arch

I'm not sure the task you describe above is the same as the one the formula under discussion tackles with. Moreover, the data on the 'photos' require retyping in order to be of effective use.

Attachments lists a few methods for posting sample exhibits which do not require retyping and the add-in https://app.box.com/s/soezox25h3w0q5s4rcyl
is also a method for posting an exhibit.<strike></strike>
 
Upvote 0
I'm not sure the task you describe above is the same as the one the formula under discussion tackles with. Moreover, the data on the 'photos' require retyping in order to be of effective use.

Attachments lists a few methods for posting sample exhibits which do not require retyping and the add-in https://app.box.com/s/soezox25h3w0q5s4rcyl
is also a method for posting an exhibit.<strike></strike>

Hi Aladin,

Sorry if this issue diverts from the original question I had thought it was along a similar line.

I have included below a link to the example spreadsheet I have constructed.

https://db.tt/vOaUDo4w

Thank you again for your help

Arch
 
Upvote 0
Would you try to post the data and the results which must obtain, instead of "posting" formula results?

Hi Aladin,

Sorry i meant to attach the version now included on the link. I've made a table of what should show up as a hardcoded version to the right.

It would be a formula that would show the sheet name where the name of the type of animal appears, to show who owns what in this case. I hope i am making sense I just can't find a solution to this problem anywhere.

https://db.tt/zf32HtgY

Thank you,

Ed
 
Upvote 0
Hi Aladin,

Sorry i meant to attach the version now included on the link. I've made a table of what should show up as a hardcoded version to the right.

It would be a formula that would show the sheet name where the name of the type of animal appears, to show who owns what in this case. I hope i am making sense I just can't find a solution to this problem anywhere.

https://db.tt/zf32HtgY

Thank you,

Ed

Ed,

You have a trailing space after Peter in the range of the sheet names in Archdog13 that you need to remove (here done so)...

Row\Col
L​
4​
SheetList
5​
James
6​
Peter
7​
Simon

James

Row\Col
A​
1​
Animals owned
2​
Dog
3​
Cat
4​
Tiger
5​
Fish
6​
Penguin
<strike></strike>
Peter

Row\Col
A​
1​
Animals owned
2​
Lion
3​
Fish
4​
Penguin
5​
Tiger
<strike></strike>

Simon

Row\Col
A​
1​
Animals Owned
2​
Tiger
3​
Fish
4​
Penguin
5​
Iguana

Archdog13

Row\Col
A​
B​
C​
D​
E​
2​
Who owns what animal?
3​
4​
Formula
5​
Animals
Name1
Name2
Name3
6​
Dog
James​
7​
Cat
James​
8​
Dolphin
9​
Iguana
Simon​
10​
Elephant
11​
Tiger
James​
Peter​
Simon​
12​
Lion
Peter​
13​
Fish
James​
Simon​
14​
Penguin
James​
Peter​
Simon​

In C6 control+shift+enter, not just enter, copy across, and down:
Rich (BB code):
=IFERROR(INDEX(SheetList,1/(1/SMALL(IF(ISNUMBER(1/COUNTIFS(INDIRECT("'"&SheetList&"'!A2:A999"),$B6)),
    ROW(INDIRECT("1:"&COUNTIFS(SheetList,"?*")))),COLUMNS($C6:C6)))),"")<strike></strike>

Note. Compared with the original: ROWS >> COLUMNS and 1/(1/...) added for error-driven output control.
 
Upvote 0
Hi Aladin,

I would like to go one step further and add an IF function related to the date.

I am using this to look up the initials of resources in project tabs to bring back the project numbers (sheet name) that each resource is working on. However, if the project is closed I don't want the sheet name to be listed. There is a project end date cell in each sheet. How can I add the test TODAY()>Project End Date for each sheet to determine if the sheet name will be returned.

Thank you in advance for your help!


Milenche
 
Upvote 0
Hi Aladin,

I would like to go one step further and add an IF function related to the date.

I am using this to look up the initials of resources in project tabs to bring back the project numbers (sheet name) that each resource is working on. However, if the project is closed I don't want the sheet name to be listed. There is a project end date cell in each sheet. How can I add the test TODAY()>Project End Date for each sheet to determine if the sheet name will be returned.

Thank you in advance for your help!


Milenche

That would require expanding the COUNTIFS bit of the formula with a date test applied to the range 'Project End Date'.
 
Upvote 0
Create a range housing the names of the relevant sheets. Select this range and name it SheetList.

Assuming that the look up value in $A4 appears say in A2:A100 on some relevant sheet, invoke:

=LOOKUP(9.99999999999999E+307,1/COUNTIF(INDIRECT("'"&SheetList&"'!A2:A100"),$A4),SheetList)

Hi,

Sorry for re-opening an old thread but I'm trying to find a solution to this issue.
Can you tell me how to create a range housing the names of the relevant sheets please?

Cheers

Chris
 
Upvote 0
Hi,

Sorry for re-opening an old thread but I'm trying to find a solution to this issue.
Can you tell me how to create a range housing the names of the relevant sheets please?

Cheers

Chris

Let's say that the relevant sheet are: Sheet1, Sheet2, and Sheet3.

Insert a new worksheet and rename this new sheet Admin.

Go the Admin.

In A2 enter: Sheet1
In A3 enter: Sheet2
In A4 enter: Sheet3

Select A2:A4, type SheetList in the Name Box on the left side of the Formula Bar.

You can now use SheetList anywhere in your workbook where you need it.
 
Upvote 0

Forum statistics

Threads
1,215,516
Messages
6,125,284
Members
449,218
Latest member
Excel Master

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