+ Reply to Thread
Results 1 to 15 of 15
  1. #1
    Registered User
    Join Date
    08-08-2007
    Posts
    43

    CountIF multiple parameters

    Well not multiple really, only two mind you.

    I have a long list of past jobs, around 4000+. I have multiple fields, but I really wish to concentrate on the:

    1) Job Type - Example would be Medical or Imprint

    2) Job # - Correlates when it was done - Example would be 91059 would be a job within 2008-2009 fiscal year.

    All the jobs are listed in the first spreadsheet. The second spreadsheet will hold generalized data broken down by the Type of Job and the fiscal year it was done.

    I wish to first count how many jobs fit a specific job type. This was easily done:

    =COUNTIF(Data!A2:A4121,A7)

    A7 = Medical
    A1:A4121 = the range of the names.

    Count comes up as 346, which is correct.

    I then want to add another parameter to break up the 346 by fiscal year. It ranges from 05-06 to 08-09. I came up with this:

    =COUNTIF(Data!A2:A4121,A7)-COUNTIF(Data!F2:F4121,"9????")

    Since the job # correlates to the fiscal year it was created, anything starting with 9 is a job done in 08-09. Anything starting with an 8 would be of course 07-08 range. I would have multiple fields with each different fiscal year.

    However, when I put the 2nd formula in the function didn't work. It keeps the count at 346, which I know is wrong. I am not sure if I did something wrong here. Been looking at this for an hour and can't figure out what is wrong. The jobs that are medical within 08-09 fiscal year should be 120, but it keeps at 346.

    Any help would be superb.

  2. #2
    Forum Moderator NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003, 2007, 2010
    Posts
    31,069

    Re: CountIF multiple parameters

    is the field starting with "9" text field?

    if yes,

    =COUNTIF(Data!A2:A4121,A7)-COUNTIF(Data!F2:F4121,"9*")

    may work.
    Microsoft MVP - Excel

    Where there is a will there are many ways. Pick One!


    Please read the Forum Rules

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

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

    Preferred Charities: Lupus Canada and Sick Kids Foundation.
    Feel Free to Donate if you want to, for the assistance you received today.

  3. #3
    Registered User
    Join Date
    08-08-2007
    Posts
    43

    Re: CountIF multiple parameters

    Quote Originally Posted by NBVC View Post
    is the field starting with "9" text field?

    if yes,

    =COUNTIF(Data!A2:A4121,A7)-COUNTIF(Data!F2:F4121,"9*")

    may work.
    Ha, too quick, I realized I posted this in the wrong section of the forums. One moment...

  4. #4
    Registered User
    Join Date
    08-08-2007
    Posts
    43

    Re: CountIF multiple parameters

    Quote Originally Posted by NBVC View Post
    is the field starting with "9" text field?

    if yes,

    =COUNTIF(Data!A2:A4121,A7)-COUNTIF(Data!F2:F4121,"9*")

    may work.
    Changed the field to a text field and changed it instead of 4 question marks to a star, but no luck, still displaying the original count of all the medical stuff.

    P.S. don't ban me, I misread this section of the forums :P

  5. #5
    Registered User
    Join Date
    08-08-2007
    Posts
    43

    Re: CountIF multiple parameters

    If you want I can stop this thread and put it in its appropriate location :P

  6. #6
    Forum Moderator NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003, 2007, 2010
    Posts
    31,069

    Re: CountIF multiple parameters

    Try then:

    =SUMPRODUCT(--Data!A2:A4121=A7),--(LEFT(Data!F2:F4121)="9"))

    P.S. I will move thread for you.
    Microsoft MVP - Excel

    Where there is a will there are many ways. Pick One!


    Please read the Forum Rules

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

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

    Preferred Charities: Lupus Canada and Sick Kids Foundation.
    Feel Free to Donate if you want to, for the assistance you received today.

  7. #7
    Registered User
    Join Date
    08-08-2007
    Posts
    43

    Re: CountIF multiple parameters

    Quote Originally Posted by NBVC View Post
    Try then:

    =SUMPRODUCT(--Data!A2:A4121=A7),--(LEFT(Data!F2:F4121)="9"))

    P.S. I will move thread for you.
    Gave me a #Value! Error. I added an extra Parenthesis after SUMPRODUCT, excel shot my an error back. Are the double negative signs needed?

  8. #8
    Forum Moderator NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003, 2007, 2010
    Posts
    31,069

    Re: CountIF multiple parameters

    Should've been:

    =SUMPRODUCT(--(Data!A2:A4121=A7),--(LEFT(Data!F2:F4121)="9"))

    If still no good.. please post sample workbook.
    Microsoft MVP - Excel

    Where there is a will there are many ways. Pick One!


    Please read the Forum Rules

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

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

    Preferred Charities: Lupus Canada and Sick Kids Foundation.
    Feel Free to Donate if you want to, for the assistance you received today.

  9. #9
    Forum Guru rwgrietveld's Avatar
    Join Date
    09-02-2008
    Location
    Netherlands
    MS-Off Ver
    XL 2007 / XL 2010
    Posts
    1,671

    Re: CountIF multiple parameters

    I always like the solution with SUMPRODUCT. I do see a small error in the formula:

    Code:
    =SUMPRODUCT(--(Data!A2:A4121=Data!A7),--(LEFT(Data!F2:F4121)="9"))
    I see that it was changed already. This message becomes obsolete.
    Last edited by rwgrietveld; 06-18-2009 at 11:57 AM.
    Looking for great solutions but hate waiting?
    Seach this Forum through Google

    www.Google.com
    (e.g. +multiple +IF site:excelforum.com/excel-general/ )

    www.Google.com
    (e.g. +fill +combobox site:excelforum.com/excel-programming/ )

    Ave,
    Ricardo

  10. #10
    Registered User
    Join Date
    08-08-2007
    Posts
    43

    Re: CountIF multiple parameters

    coming up with 0 as the value now. Meeting in 2 minutes, going to upload the workbook when I get back.

  11. #11
    Registered User
    Join Date
    08-08-2007
    Posts
    43

    Re: CountIF multiple parameters

    Nevermind, meeting canceled. Figures the meeting that only requires 5 seconds of input from myself gets canceled....

    Took out a lot of the un-necessary info and put in specifically whats needed. To be clear:

    The A range is the same, but switch F columns to C for this workbook.

    The numbers inbetween the name and the Job number are there for a specific reason. 10,11,12 and all numbers above 30 are specific products. However, 30 itself is a mash of many types of products, so that is why I am trying to sort by name, not by number. And as you can tell I am not done categorizing product code 30 by name.
    Attached Files Attached Files

  12. #12
    Forum Moderator NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003, 2007, 2010
    Posts
    31,069

    Re: CountIF multiple parameters

    It worked for me...

    I get 38...

    I put "Medical" in M1 to refer to it.. and formula in N1
    Attached Files Attached Files
    Microsoft MVP - Excel

    Where there is a will there are many ways. Pick One!


    Please read the Forum Rules

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

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

    Preferred Charities: Lupus Canada and Sick Kids Foundation.
    Feel Free to Donate if you want to, for the assistance you received today.

  13. #13
    Registered User
    Join Date
    08-08-2007
    Posts
    43

    Re: CountIF multiple parameters

    Quote Originally Posted by NBVC View Post
    It worked for me...

    I get 38...

    I put "Medical" in M1 to refer to it.. and formula in N1
    That is screwed up....

    Give me 5 minutes, I want to try it on my original excel spreadsheet

  14. #14
    Registered User
    Join Date
    08-08-2007
    Posts
    43

    Re: CountIF multiple parameters

    Quote Originally Posted by Karroog View Post
    That is screwed up....

    Give me 5 minutes, I want to try it on my original excel spreadsheet
    Found it:

    In the original spreadsheet there are a lot of spacing issues because I imported the excel sheet off of a data sheet from a program called Crystal Report. It has a tendency to mesh all the fields together to look good on a printout. The original function I had F as the area, but it was actually D. That's why it wasn't working.

    And the 38 for medical, I just can't count this morning :P

    Thanks again!

  15. #15
    Forum Moderator NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003, 2007, 2010
    Posts
    31,069

    Re: CountIF multiple parameters

    If you are satisfied with the solution(s) provided, 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
    Microsoft MVP - Excel

    Where there is a will there are many ways. Pick One!


    Please read the Forum Rules

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

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

    Preferred Charities: Lupus Canada and Sick Kids Foundation.
    Feel Free to Donate if you want to, for the assistance you received today.

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.2.0