+ Reply to Thread
Results 1 to 10 of 10

Help with a count/vlookup formula

  1. #1
    Forum Contributor TechRetard's Avatar
    Join Date
    06-14-2009
    Location
    Houston, TX
    MS-Off Ver
    Excel 2010
    Posts
    202

    Help with a count/vlookup formula

    Sheet 1: Primary Key, column A....wanted formula in column B
    1 [Formula]
    2 [Formula]
    3 [Formula]


    Sheet 2: Data columns A-E, column A is primary key, B-E are either blanks or dates
    1 41000 41500
    2
    3 41001

    The formula looks at the key on sheet 1, looks it up, and then counts how many "dates" are the columns on sheet 2 corresponding to the key

    example: for 1, the formula would return 2, because there are 2 dates listed for #1 on the second sheet
    example2: for 2, the formula would return 0, because there are no dates listed for #2 on the second sheet

    ...thanks in advance
    Last edited by TechRetard; 09-09-2014 at 08:14 AM. Reason: SOLVED
    TechRetard.ToString();

    There are always multiple ways to do something, when it doubt, drink a beer.

    I do not care if you rep or not but please mark post as Solved if there is resolution so I stop going back and checking if anything else is needed.

  2. #2
    Forum Expert
    Join Date
    03-28-2014
    Location
    Hyderabad,India
    MS-Off Ver
    Excel 2013
    Posts
    1,887

    Re: Help with a count/vlookup formula

    Hi,

    Check this

    Punnam
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    01-20-2014
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    52

    Re: Help with a count/vlookup formula

    If you have the same ascending Primary Key in both worksheets why dont you just use a simple count formula?
    In cell B1

    Please Login or Register  to view this content.
    and drag down.
    +++ If I helped please add reputation +++

  4. #4
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Help with a count/vlookup formula

    In B2:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Copy down.
    let Source = #table({"Question","Thread", "User"},{{"Answered","Mark Solved", "Add Reputation"}}) in Source

    If I give you Power Query (Get & Transform Data) code, and you don't know what to do with it, then CLICK HERE

    Walking the tightrope between genius and eejit...

  5. #5
    Forum Expert
    Join Date
    03-28-2014
    Location
    Hyderabad,India
    MS-Off Ver
    Excel 2013
    Posts
    1,887

    Re: Help with a count/vlookup formula

    Alternative with Indirect + Countif+match paste it in b2
    =IFERROR(COUNTIF(INDIRECT("Sheet2!"&"B"&(MATCH(A2,Sheet2!$A$2:$A$4,0)+1)&":"&"E"&(MATCH(A2,Sheet2!$A$2:$A$4,0)+1)),"<>"&""),"")
    Punnam

  6. #6
    Forum Contributor TechRetard's Avatar
    Join Date
    06-14-2009
    Location
    Houston, TX
    MS-Off Ver
    Excel 2010
    Posts
    202

    Re: Help with a count/vlookup formula

    Close... but I can't hard code in just one row on the Countif because I don't know which row that is...see modified exampleIf + Countif+Array_TR.xlsx

  7. #7
    Forum Expert
    Join Date
    03-28-2014
    Location
    Hyderabad,India
    MS-Off Ver
    Excel 2013
    Posts
    1,887

    Re: Help with a count/vlookup formula

    Hi ,
    Check with my another post 5,
    =IFERROR(COUNTIF(INDIRECT("All Data!"&"B"&(MATCH(A2,All Data!$A$2:$A$11,0)+1)&":"&"E"&(MATCH(A2,All Data!$A$2:$A$11,0)+1)),"<>"&""),"")
    it will take care .Just Replace Sheet2 with the new sheet name Checked & works fine for me
    Punnam
    Attached Files Attached Files

  8. #8
    Forum Contributor TechRetard's Avatar
    Join Date
    06-14-2009
    Location
    Houston, TX
    MS-Off Ver
    Excel 2010
    Posts
    202

    Re: Help with a count/vlookup formula

    Olly/Cs454, thanks for taking a moment to help me out ... the example was just for simplicity, it's not a 1 to 1 row match as i tried to show in my modified example via .xlsx above. Looking for something a little more robust as sheet 2 is the 'all data' tab and sheet 1 will just be a summary, where the primary key #s may change depending on other variables... in actuality my workbook is about 50 columns and hundreds of rows

  9. #9
    Forum Contributor TechRetard's Avatar
    Join Date
    06-14-2009
    Location
    Houston, TX
    MS-Off Ver
    Excel 2010
    Posts
    202

    Re: Help with a count/vlookup formula

    Quote Originally Posted by Punnam View Post
    Hi ,
    Check with my another post 5,
    =IFERROR(COUNTIF(INDIRECT("All Data!"&"B"&(MATCH(A2,All Data!$A$2:$A$11,0)+1)&":"&"E"&(MATCH(A2,All Data!$A$2:$A$11,0)+1)),"<>"&""),"")
    it will take care .Just Replace Sheet2 with the new sheet name Checked & works fine for me
    Punnam
    Got it to work, thank you sir

  10. #10
    Forum Expert
    Join Date
    03-28-2014
    Location
    Hyderabad,India
    MS-Off Ver
    Excel 2013
    Posts
    1,887

    Re: Help with a count/vlookup formula

    Hi TechRetard ,

    Thanks for the reps. u r welcome.

    Punnam

+ 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. [SOLVED] vlookup list in sheet2 and count from sheet how many times item is entered formula / vba
    By KK1234 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-12-2014, 02:12 PM
  2. [SOLVED] Row delete macro is effecting record count formula and vlookup code. #REF!
    By Nitefox in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 14
    Last Post: 10-20-2013, 10:13 PM
  3. Row delete macro is effecting record count formula and vlookup code.
    By Nitefox in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 2
    Last Post: 10-13-2013, 06:23 PM
  4. [SOLVED] Count and average formula needed to not count text field
    By excelteam777 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 07-07-2013, 05:30 PM
  5. Replies: 5
    Last Post: 08-29-2012, 05:25 PM

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