+ Reply to Thread
Results 1 to 5 of 5

Count and VLookup Across Multiple Sheets

  1. #1
    Registered User
    Join Date
    10-15-2013
    Location
    Scotland
    MS-Off Ver
    Microsoft 365
    Posts
    71

    Count and VLookup Across Multiple Sheets

    Hi.

    I have an Excel (2016) file with sheets for every day of this month, containing an table of info on each sheet, in the same location - just the staff member names in the first column are different. (I've attached a sample spreadsheet with a few names on it.)

    On a "Summary" sheet, I want to look up a staff member's name, search across all of the daily sheets (labelled "1 Mar", "2 Mar", "3 Mar" etc...) and provide a count IF column 2 on each table contains a 1 (col 2 will either be 1 or 0.)

    I've given the sheets a Name of "lookup_sheets" and I'm currently using the following formula to do this:

    =VLOOKUP(B5,INDIRECT("'"&INDEX(lookup_sheets,MATCH(1,--(COUNTIF(INDIRECT("'"&lookup_sheets&"'!$b$3:$d$10"),B5)>0),0))&"'!$b$3:$d$10"),2,FALSE)

    However, with the first name on the list I'm getting a result of 1 but it should be 3 because although the name appears on each of the sheets there is only a "1" on three of them... Clearly I've gone wrong somewhere with the formula but I can't see where! Can anyone help? (Or even suggest a better/easier way to do this!)
    Attached Files Attached Files

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,201

    Re: Count and VLookup Across Multiple Sheets

    The VLOOKUP will NOT do what you want, as it will return ONLY 1 result. Furthermore, the correct answer is 2, not 3, as Adam Gannee on 5 March is recorded as Adam Ganee1, which is not the same as Adam Ganee.

    =SUMPRODUCT(COUNTIFS(INDIRECT("'"&lookup_sheets&"'!B3:B10"),B5,INDIRECT("'"&lookup_sheets&"'!C3:C10"),1))

    does work.
    Attached Files Attached Files
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU

  3. #3
    Registered User
    Join Date
    10-15-2013
    Location
    Scotland
    MS-Off Ver
    Microsoft 365
    Posts
    71

    Re: Count and VLookup Across Multiple Sheets

    Hi Glenn.

    You are right! Two is correct - I was messing about with some other methods and forgot I added a 1 to the end of one of the Adam Ganee entries!

    Your solution works perfectly, so thank you for your help; it's much appreciated

  4. #4
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,201

    Re: Count and VLookup Across Multiple Sheets

    You're welcome.



    It would be very nice if you were to just click the Add Reputation button at the foot of any of the posts of members who helped you reach a solution.

    Finally, if that takes care of your original question, please select "Thread Tools" from the menu link above and mark this thread as SOLVED.

  5. #5
    Registered User
    Join Date
    10-15-2013
    Location
    Scotland
    MS-Off Ver
    Microsoft 365
    Posts
    71

    Re: Count and VLookup Across Multiple Sheets

    Hi Glenn.

    I did both of those things just after posting #3. If this hasn't registered I must be having some technical issues today (especially with my earlier double post issue!) That's what I get for doing this during work time on outdated browsers!

+ 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. VLOOKUP Count values in multiple sheets
    By Bilbo007 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-13-2019, 05:25 AM
  2. [SOLVED] Formula to count matches between multiple columns on different sheets w/ multiple criteria
    By RICK JAMES in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 01-05-2019, 03:28 PM
  3. Replies: 0
    Last Post: 01-11-2013, 02:39 AM
  4. count if and vlookup all in one from various sheets?
    By Lorna B in forum Excel General
    Replies: 3
    Last Post: 08-24-2012, 07:52 AM
  5. Replies: 8
    Last Post: 07-13-2012, 06:00 AM
  6. Count - multiple criteria, multiple sheets, and date range.
    By threecliffs in forum Excel General
    Replies: 6
    Last Post: 06-14-2011, 01:36 PM
  7. Count unique logs with multiple conditions of multiple sheets
    By Robert Bob in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 10-12-2007, 12:49 AM

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