+ Reply to Thread
Results 1 to 9 of 9

VLOOKUP and COUNTIF

  1. #1
    Registered User
    Join Date
    02-28-2014
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    12

    VLOOKUP and COUNTIF

    So I need to look up a value in column B and determine whether or not it is less than the value in cell A1. If the value in column B is less than A1, then I need to count the number of "TRUE" in column A and return that number in cell B1. I think I need to use some combination of CountIf and Vlookup but I'm not sure how to do it. Any help would be appreciated, thanks.
    Attached Files Attached Files

  2. #2
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,466

    Re: VLOOKUP and COUNTIF

    Maybe in B1:
    =SUMPRODUCT(($B$3:$B$270<$A$1)*$A$3:$A$270)
    Note that blank cells will be 0 then counted as <A1
    Quang PT

  3. #3
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: VLOOKUP and COUNTIF

    I think the answer based on the data in column be should be 150

    =COUNT(IF(B3:B260<$A$1,B3:B260))

    ...confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer. Press F2 on that cell and try again.
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: VLOOKUP and COUNTIF

    Here is an alternative to bebo021999's formula, which gives the same result (available in Excel 2007 forward):

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


    AlKey's result does not seem to be taking the TRUE/FALSE values in column A into consideration.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  5. #5
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: VLOOKUP and COUNTIF

    @6StringJazzer, I maybe wrong, but I think the column A is for illustration purposes.

  6. #6
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: VLOOKUP and COUNTIF

    actually the countifs works better it doesnt count blanks that have true
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  7. #7
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: VLOOKUP and COUNTIF

    @AlKey, there are 150 values in column B that are less than the value in A1. If we are after that 150 number, the simplest formula would be

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


    However, there are 95 TRUE values in column A, and they don't correlate to whether the value in column B is less than A1. The OP seems to looking for the combination of the two, based on:
    If the value in column B is less than A1, then I need to count the number of "TRUE" in column A and return that number in cell B1.
    opsanalysis07, for this type of problem it always helps to tell us what you think the result should be.
    Last edited by 6StringJazzer; 03-04-2014 at 02:33 PM. Reason: adjusted range reference in COUNTIF

  8. #8
    Registered User
    Join Date
    02-28-2014
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: VLOOKUP and COUNTIF

    I guess I didn't manually count them to know what the result should have been. Or present the problem very clearly. My apologies. If the value in column B is less than A1, then I need to count it IF it also has the word TRUE in column A. The result should be 41.

    bebo021999 and 6StringJazzer had it right. Thanks a lot, everyone.

  9. #9
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: VLOOKUP and COUNTIF

    Use the sumifs when you use sumproduct any time you have true
    and a blank it gets counted
    So if you change one of the cels at the end to
    True you get 42 but sumifs gives 41

+ 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 and COUNTIF together?
    By wrekin in forum Excel General
    Replies: 2
    Last Post: 01-28-2010, 03:36 PM
  2. Not sure if this is Vlookup, countif or even both...
    By the-kiddy in forum Excel General
    Replies: 7
    Last Post: 11-24-2009, 06:19 PM
  3. Vlookup & countif help
    By myarna in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-17-2009, 07:23 PM
  4. [SOLVED] vlookup and countif???
    By Joe in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-13-2006, 06:33 AM
  5. Countif or Vlookup
    By praveen_khm in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-03-2006, 04:17 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