+ Reply to Thread
Results 1 to 7 of 7

Lookup and Countif combination

Hybrid View

  1. #1
    Registered User
    Join Date
    05-11-2009
    Location
    london
    MS-Off Ver
    Excel 2007
    Posts
    4

    Lookup and Countif combination

    Hi. I'm trying to use a combination of Hlookup and COUNTIF. I'm selecting a date value in a cell using data validation. I'm then wanting to write a formula to lookup that value in a row of dates, and then use a countif to find all the '1' values in that column.
    Could anyone help?
    Last edited by blackhawk; 05-11-2009 at 04:41 PM.

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

    Re: Lookup and Countif combination

    Something like this:

    =SUMPRODUCT((E2:H2=A1)*(E3:H8=1))

    where E2:H2 contains row of dates... and A1 contains choice date...

    E3:H8 is table underneath dates row containing 1's, etc...

    adjust ranges to suit.
    Where there is a will there are many ways.

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

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

  3. #3
    Registered User
    Join Date
    05-11-2009
    Location
    london
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Lookup and Countif combination

    Quote Originally Posted by NBVC View Post
    Something like this:

    =SUMPRODUCT((E2:H2=A1)*(E3:H8=1))

    where E2:H2 contains row of dates... and A1 contains choice date...

    E3:H8 is table underneath dates row containing 1's, etc...

    adjust ranges to suit.
    That works fine. Spent hours trying to get my head around this!!
    Thanks loads.

  4. #4
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,065

    Re: Lookup and Countif combination

    Use SUMPRODUCT with unary "--" to count, e.g.

    =SUMPRODUCT((A1:A10=date)*--(B1:B10=1))
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  5. #5
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Lookup and Countif combination

    Please mark your thread as Solved.

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

  6. #6
    Registered User
    Join Date
    11-14-2008
    Location
    Tampa
    MS-Off Ver
    Professional Plus 2007
    Posts
    30

    Re: Lookup and Countif combination

    Here's another way

    =COUNTIF(OFFSET(F2:F20,0,MATCH(A1,F1:O1)-1),1)
    where:
    A1 holds the date entry
    F2:F20 is the first column of data values from row 2 to 20 (0,1,2,3,4,etc..)
    F1:O1 is the table header, which holds the different dates, one for each column from F to O. (May 1, May 2, etc...)

    That was fun

  7. #7
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Lookup and Countif combination

    though OFFSET is volatile.

+ 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.6.0 RC 1