+ Reply to Thread
Results 1 to 3 of 3

VLOOKUP and COUNTIF together?

  1. #1
    Registered User
    Join Date
    01-23-2010
    Location
    telford, england
    MS-Off Ver
    Excel 2007
    Posts
    2

    VLOOKUP and COUNTIF together?

    Hi,

    Please can someone help me with a problem that I have with a formula.

    My boss has asked me to work this one out and is putting me under great pressure to resolve it. I have tried Vlookup and COUNTIF etc but just cannot get to make it work.

    I have attached an example file but to explain:

    I have a database of inspectors faults, in column B, I have the week number, column*C, I have the part number & column C the fault category (this includes OK). The actual database is up to 5000 rows now.

    What I need to be able to do is in one cell (column H2) count all the OK's for week 1 and all the Not OK's (column I2) in week 1 and the same for week 2 (column H3) and week 3 (column H4) and so on for the whole year. I have tried a vlookup using cell G2 (containing "1") as the search and the week number column as the range and then counting if OK, but it never worked!

    Any help would be gratefully appreciated and you will be saving me from the wrath of my boss ;-)


    Wrekin
    Attached Files Attached Files
    Last edited by NBVC; 01-28-2010 at 04:25 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: VLOOKUP and COUNTIF together?

    In H2: =SUMPRODUCT(--($B$2:$B$58=$G2),--($D$2:$D$58="OK"))

    in I2: =SUMPRODUCT(--($B$2:$B$58=$G2),--($D$2:$D$58<>"OK"))

    adjust the ranges to suit your data and then copy both down the columns.

    In XL2007, these should also work

    =COUNTIFS($B$2:$B$58,$G2,$D$2:$D$58,"OK")

    =COUNTIFS($B$2:$B$58,$G2,$D$2:$D$58,"<>OK")
    Last edited by NBVC; 01-27-2010 at 05:18 PM.
    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
    01-23-2010
    Location
    telford, england
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: VLOOKUP and COUNTIF together?

    NBVC you are a God, many thanks you have saved by bacon ;-)

    Wrekin

+ 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