+ Reply to Thread
Results 1 to 21 of 21

List of all worksheets where a cell contents appears

  1. #1
    Registered User
    Join Date
    08-06-2016
    Location
    Midlands, England
    MS-Off Ver
    2013
    Posts
    7

    List of all worksheets where a cell contents appears

    UPDATE,
    The attached workbook is a sample of what I have created so far.
    Cell P8 on the 'Master Parts List' sheet is where I want to input a specific part number.
    Cell Q8..Q9..onwards, is where I wish to list all the worksheets where the part number appears (eg. BOM_1...BOM_2...etc).
    Cell R8..R9..onwards, is where I wish to list the row number in which the part number appears on a particular worksheet.
    ---------------------------------

    As my nickname indicates I'm clearly not smart enough, so i'm calling out for your assistance dear forum.

    I have an excel workbook containing a number of growing worksheets, each representing a Bill of Materials.

    Each worksheet will contain a list of 'part numbers'. the same 'part number' can appear on any worksheet (but not all worksheets).

    What I would like to do (on worksheet 1, say) is have a cell where I can input a specific 'part number' and generate a list of all worksheets that 'part number' appears.

    Also, if possible to list the worksheet row number for that 'part number' location.

    Finally, it needs to be done as a formula and NOT any VB macro.

    I've look through the various posts but couldn't see anything along these lines. If there is I apologies.

    Any assistance will be very greatly received.

    many thanks
    Not-smart-Enough.
    Attached Files Attached Files
    Last edited by Not-Smart-Enough; 08-06-2016 at 11:58 AM. Reason: Sample workbook attached

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,390

    Re: List of all worksheets where a cell contents appears

    Welcome! Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: List of all worksheets where a cell contents appears

    Quote Originally Posted by Not-Smart-Enough View Post
    Finally, it needs to be done as a formula and NOT any VB macro.
    Not VB macro, or not VBA of an kind?

    Possibly it could be done with a UDF, which is a formula that uses vba to create new functions, but without any vba use, you are asking the impossible.

  4. #4
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: List of all worksheets where a cell contents appears

    I didn't download your file.

    Technically, you can generate a list of sheet names without VBA. The technique uses a macro function which is what Excel used before it changed over to VBA. So, it's not VBA but it does require you to save the file as a macro enabled file.

    If you can't/don't want to use either VBA or the macro function then your options are limited.

    You'll have to manually generate the sheet names. You can either do that by hardcoding the sheet names directly in the formula or you can list the sheet names in a range of cells.

    How many sheets are there? What are their names?
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  5. #5
    Registered User
    Join Date
    08-06-2016
    Location
    Midlands, England
    MS-Off Ver
    2013
    Posts
    7

    Re: List of all worksheets where a cell contents appears

    Hi Jason,

    Apart from never usng macros I'd prefer not to rely on them due to distribution requirements of the final spreadsheet.

    That being said, in the short term any solution at the moment would be very usefull.

    As I refer to earlier I'm not a wizz so any solution using a macro I would need some clear guidlines on how to impliment it.


    many thanks in advance.

  6. #6
    Registered User
    Join Date
    08-06-2016
    Location
    Midlands, England
    MS-Off Ver
    2013
    Posts
    7

    Re: List of all worksheets where a cell contents appears

    Hi Tony,

    I shall be manually adding and renaming new sheets.

    What I need to do is use say cell [A1 - sheet 1] to enter a part number '123' and then have cell B1, B2, B3 etc (sheet 1) list all the other sheets names (sheet 2, sheet 3 etc) where that part number appears.

    The sample file is set up to give you an idea of what I'm looking for. The input filed there is P8

    Thanks,
    Mark.

  7. #7
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,306

    Re: List of all worksheets where a cell contents appears

    VBA solution:

    See here how to Start VBA editor

    http://www.techonthenet.com/excel/ma...editor2010.php

    Please Login or Register  to view this content.
    Click RUN on "MAster Parts List"
    Attached Files Attached Files
    Last edited by JohnTopley; 08-07-2016 at 06:15 AM.

  8. #8
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: List of all worksheets where a cell contents appears

    A variation on John's suggestion, this one runs automatically when you change the part number in P8.

    Right click the sheet name tab for 'Master Parts List' then click 'View code'

    Copy the code below and paste into the editor.

    Please Login or Register  to view this content.
    Close the editor and save excel. When you see a warning message about macro free / macro enabled workbooks, click 'No' and change the file extension type to .xlsm

    Based on your original post and the format of your sample file, I've assumed only 1 part number at any time on the master part list, also that each part number will only appear once on any of the other sheets.

    The code can be modified to allow multiple occurences if needed.
    Last edited by jason.b75; 08-07-2016 at 06:34 AM.

  9. #9
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,306

    Re: List of all worksheets where a cell contents appears

    @Jason,
    ..like it!

    You might like to add message if part not found

  10. #10
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: List of all worksheets where a cell contents appears

    Here's a small sample file that demonstrates this.
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    08-06-2016
    Location
    Midlands, England
    MS-Off Ver
    2013
    Posts
    7

    Re: List of all worksheets where a cell contents appears

    Good afternoon forum

    Smiling today as the mcros from Jason and John work great. A big thank you for your help guys.
    I'm macro challenged but I managed to work my way through your suggestions.

    Also a big thank you to Tony for his formua based solution. This is more ideally suited to my limited skill set.
    I have tweaked the formula slightly to more suit my tab nomenclature and the only thing I could possibly ask for (and I know I'm pushing my luck here) is to modify the formula to refer to a sheet name list rather than adding any new sheet names to the formula each time.

    My slight mod.
    =IFERROR(INDEX({"Q331","Q441","Q551","Q661"},SMALL(IF(COUNTIF(INDIRECT("Q"&{331;441;551;661}&"!A2:A10"),$A$5),{1;2;3;4}),ROWS(B$5:B5))),"")

    The more sheets I have the longer the formula becomes. So referring to a sheet name list (if possible) would eliminate this issue.

    Again to ALL thank you very much and take heart in helping out an enthusiastic if Not-Smart-Enough excel user.

    Mark.
    Last edited by Not-Smart-Enough; 08-07-2016 at 12:11 PM.

  12. #12
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: List of all worksheets where a cell contents appears

    Using a range of cells to hold the sheet names...

    Data Range
    A
    B
    C
    1
    Sheet Names
    Lookup
    Sheets
    2
    Q331
    X
    Q331
    3
    Q441
    Q551
    4
    Q551
    Q661
    5
    Q661


    This array formula** entered in C2:

    =IFERROR(INDEX(A$2:A$5,SMALL(IF(COUNTIF(INDIRECT(A$2:A$5&"!A2:A10"),B$2),{1;2;3;4}),ROWS(C$2:C2))),"")

    ** array formulas need to be entered using the key
    combination of CTRL,SHIFT,ENTER (not just ENTER).
    Hold down both the CTRL key and the SHIFT key
    then hit ENTER.

    Copy down until you get blanks.

  13. #13
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: List of all worksheets where a cell contents appears


  14. #14
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,306

    Re: List of all worksheets where a cell contents appears

    Try

    =IFERROR(INDEX(Sheets,SMALL(IF(COUNTIF(INDIRECT(Sheets&"!$B$6:$B$500"),$P$8),ROWS($1:1)),ROWS(Q$8:Q8))),"")

    "Sheets" is named range of tab names

    What about ROW number?

  15. #15
    Registered User
    Join Date
    08-06-2016
    Location
    Midlands, England
    MS-Off Ver
    2013
    Posts
    7

    Re: List of all worksheets where a cell contents appears

    Hi Tony,

    Thats the kind of thing I was thinking of. I notice that when I add to column A. I need to add the next sequential number to the {1;2;3;4} sequence.
    This isn't a problem, I'm just checking as it seems to work ok when I do.

    I've also tried to do a =match(B2,C2,A:A,0) to obtain the row number but it obviously doesn't recognise the cell result (Q331).
    If I can get the row number of B2 that appears in the worksheet listed in C2, C3 etc then that should be the final piece.

    many many thanks
    Mark.

  16. #16
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,306

    Re: List of all worksheets where a cell contents appears

    If you use formula in post #14, no change is required: just drag in down from Q8.


    To get ROW ..

    in R8

    =IFERROR(MATCH($P$8,INDIRECT("'" &Q8& "'!B1:B500"),0),"")

    Copy down
    Last edited by JohnTopley; 08-07-2016 at 03:32 PM.

  17. #17
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,306

    Re: List of all worksheets where a cell contents appears

    To get ROW ..

    in R8

    =IFERROR(MATCH($P$8,INDIRECT("'" &Q8& "'!B1:B500"),0),"")

    Copy down

  18. #18
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: List of all worksheets where a cell contents appears

    Here's an updated sample file that demonstrates this.

  19. #19
    Registered User
    Join Date
    08-06-2016
    Location
    Midlands, England
    MS-Off Ver
    2013
    Posts
    7

    Re: List of all worksheets where a cell contents appears

    As we say here in England.....Nailed It!

    That all seems to work great.

    I shall try it on my full spreadsheet tomorrow and let you know how I get on.

    If you're a beer drinker you've earned it, thank you.
    Mark

  20. #20
    Registered User
    Join Date
    08-06-2016
    Location
    Midlands, England
    MS-Off Ver
    2013
    Posts
    7

    Re: List of all worksheets where a cell contents appears

    Hi John,

    I'm still working through your suggestions but I'll definitely persevere.
    I think it's just me whos failing at the moment.

    I will let you know how I get on.

    Thank you so much for your help, I'm learning a lot.
    Mark.

  21. #21
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: List of all worksheets where a cell contents appears

    Quote Originally Posted by Not-Smart-Enough View Post
    If you're a beer drinker you've earned it
    St. Pauli Girl Dark!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Message box which appears when a cells contents are 0 or less
    By Nic31 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-17-2014, 08:59 PM
  2. Replies: 5
    Last Post: 04-23-2013, 05:11 PM
  3. [SOLVED] Macro to copy cell contents from the Header sheet into cell A2 on all worksheets
    By jsantos in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-15-2012, 06:28 PM
  4. Replies: 2
    Last Post: 06-28-2012, 10:49 AM
  5. Formula that returns the contents of a cell based on where a value appears
    By shieldsp1 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-18-2010, 06:45 PM
  6. Update Worksheets on Change of List Box Contents
    By alis88 in forum Excel General
    Replies: 0
    Last Post: 08-14-2008, 05:07 AM
  7. Adding cell contents in different worksheets
    By Supersaint in forum Excel General
    Replies: 3
    Last Post: 01-11-2006, 12:30 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1