Consulting

Results 1 to 5 of 5

Thread: Solved: Using Countif with multiple criteria

  1. #1
    VBAX Regular
    Joined
    Sep 2008
    Posts
    8
    Location

    Solved: Using Countif with multiple criteria

    Need some help with excel. Basically I am trying to use a Countif function to return a value on multiple conditions. i.e.

    Column 1 has to meet one of two four letter codes while column 2 has to meet only 1 single letter condition. In simple syntax

    If D210000 = MGEN or RIFA and F2:F10000 = U then count them and return numerical value.

    Can i use countif or is there a better way? I have tried nesting functions and using database functions but am getting nowhere. Any help appreciated.

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    A database function should do it, but the simplest is

    =SUMPRODUCT((D2:D10000={"MGEN","RIFA"})*(F2:F10000="U"))
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    VBAX Regular
    Joined
    Sep 2008
    Posts
    8
    Location

    Smile

    Thank you for that. I have just pasted it into my workbook and it works a treat. Looks like I have some reading to do on sumproduct functions.

    Thanks again

    Bruce

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    I have started a tutorial on SUMPRODUCT in the SUMPRODUCT sub-forum http://www.vbaexpress.com/forum/foru...aysprune=&f=98
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  5. #5
    VBAX Regular
    Joined
    Sep 2008
    Posts
    8
    Location
    Just been reading the sumproduct forum its very enlightening

    regards
    Bruce

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •