+ Reply to Thread
Results 1 to 8 of 8

Troubleshooting Sumproduct and Countif formula

  1. #1
    Forum Contributor
    Join Date
    02-16-2008
    Location
    Mansfield, TX
    Posts
    324

    Troubleshooting Sumproduct and Countif formula

    Hello, I was hoping for some help trouble shooting a formula. I am trying to count the number of vacation days for each person on the Jan worksheet using this formula. For some reason, it is counting all of the vacation days, and not just the vacation days for one person. Any help would be greatly appreciated. The formula is on the vacation sheet in cell D3.



    =(SUMPRODUCT(--(jan=Input!$B18)--(jan=A3))-COUNTIF(jan,A3))

    Thanks!
    Clayton Grove
    Attached Files Attached Files
    Last edited by dcgrove; 11-15-2008 at 04:43 AM.

  2. #2
    Forum Expert oldchippy's Avatar
    Join Date
    02-14-2005
    Location
    Worcester, UK
    MS-Off Ver
    Excel 2007 (Home)
    Posts
    7,097
    Hi,

    Try this,

    =SUMPRODUCT(--(jan=Input!$B18),--(jan=A3))+COUNTIF(jan,A3)
    oldchippy
    -------------


    Blessed are those who can give without remembering and take without forgetting

    If you are happy with the help you have received, please click the <--- STAR icon on the left - Thanks.

    Click here >>> Top Excel links for beginners to Experts

    Forum Rules >>>Please don't forget to read these

  3. #3
    Forum Contributor
    Join Date
    02-16-2008
    Location
    Mansfield, TX
    Posts
    324
    Thanks for the help bit it is not counting the instances that vacatio. Is showing up, it is counting the instances of the names. I need it to count how many times "Vacation" shows up in each row per name on the sheet.


    Thanks again!

    Clayton
    Last edited by dcgrove; 11-15-2008 at 02:05 AM.

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492
    Protected sheet....not cool.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  5. #5
    Forum Contributor
    Join Date
    02-16-2008
    Location
    Mansfield, TX
    Posts
    324
    Really? The protection was not intentional. I copies those three sheets from the original worksheet because it was too large to upload. The password is leftycj7

  6. #6
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531
    Because of the fact you're using named ranges where named range encompasses both conditional arrays (D,E:K) and the fact you're looking in arrays of different sizes I think you need something like:

    =SUMPRODUCT((INDEX(jan,0,2):INDEX(jan,0,8)=Input!$B18)*(INDEX(jan,0,1)=A3))

    I would also be VERY wary of using named ranges where name = sheet name... invariably this will cause you headaches in the long run.

    If you don't quantify the INDEX ranges you will end up with an answer of 0, eg:

    =SUMPRODUCT((jan=Input!B18)*(jan=$A3))

    will = 0 because you would need a name = Input!B18 to ever get a true result... given name <> absence type the first record in the array will always be FALSE and thus regardless of any other results the PRODUCT of that row in the array will be 0.

  7. #7
    Forum Contributor
    Join Date
    02-16-2008
    Location
    Mansfield, TX
    Posts
    324
    That formula worked! Thanks for the explanation. I completely agree on the named ranges equaling the sheet names. I usually try and make the name as descriptive of the range as possible but I was in a hurry to post this and not feeling very creative.

    Clayton Grove

  8. #8
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531
    No problem -- please mark as SOLVED

+ 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