+ Reply to Thread
Results 1 to 4 of 4

Thread: If Statement Across All Sheets

  1. #1
    Registered User
    Join Date
    06-22-2009
    Location
    Lincoln
    MS-Off Ver
    Excel 2003
    Posts
    47

    If Statement Across All Sheets

    Here's my problem:

    I have over 300 sheets in a workbook. 299 of them are identically set up and each contains the name of an office in cell A4 (though each sheet is simply named sheet1, sheet2, sheet3 etc). The last one is a calculations sheet. On the calculations sheet I have a list of the office names that starts at A1 and continues down column A.

    What I would like to do is enter an IF statement in B1 (on the calculations sheet) that will search cell A4 on every sheet for the office name in A1 on the calculations sheet. When it finds a match I'd like it to pull out information from cell C7 of that sheet and enter it into cell B1 of the calculations sheet. I'd then like to copy this down for each entry in the list.

    That's confusing so I'll try giving an example of what I need. This would be the sort of thing I'd like to enter in cell B1 on the calculations sheet (I know it doesn't make sense as it stands, I'm just using it as a visual representation):

    =IF(ALLSHEETS!A4=CALCULATIONS!A1,FOUNDSHEET!C7,"")
    I know it can probably be done by entering every sheet name, but with the number of sheets I'm working with it isn't practical. Thinking about it, it's proably a VBA thing, but I thought I'd explore this possibility first.

    Any ideas?
    Last edited by jennyaccord; 12-12-2011 at 09:23 AM.

  2. #2
    Forum Guru NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    32,636

    Re: If Statement Across All Sheets

    Perhaps (not sure if 299 is too many sheets)?

    =SUMPRODUCT(SUMIF(INDIRECT("'Sheet"&ROW(INDIRECT("1:299"))&"'!A4"),A1,INDIRECT("'Sheet"&ROW(INDIRECT ("1:299"))&"'!C7")))
    Microsoft MVP - Excel

    Where there is a will there are many ways. Pick One!


    Please read the Forum Rules

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

    Preferred Charities: Lupus Canada and Sick Kids Foundation.
    Feel Free to Donate if you want to, for the assistance you received today.

  3. #3
    Registered User
    Join Date
    06-22-2009
    Location
    Lincoln
    MS-Off Ver
    Excel 2003
    Posts
    47

    Re: If Statement Across All Sheets

    NBVC, you may have just saved my life and possibly the universe. You are, quite possibly, the greatest human being alive.

    Thank you, thank you, thank you.

  4. #4
    Forum Guru NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    32,636

    Re: If Statement Across All Sheets

    You are most welcome Glad to help.
    Microsoft MVP - Excel

    Where there is a will there are many ways. Pick One!


    Please read the Forum Rules

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

    Preferred Charities: Lupus Canada and Sick Kids Foundation.
    Feel Free to Donate if you want to, for the assistance you received today.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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.2.0