+ Reply to Thread
Results 1 to 7 of 7

Adding Conditional look up to SUMPRODUCT and COUNTIF

  1. #1
    Registered User
    Join Date
    05-10-2013
    Location
    New York
    MS-Off Ver
    Excel 2010
    Posts
    29

    Adding Conditional look up to SUMPRODUCT and COUNTIF

    Hi All!

    I'm working with a spreadsheet that pulls data from another page. I have all my formulas figured out for when I only have one user, but I struggle when I want to create it for the master list (breaking it down by person's name). Let me give an example:

    Worker Name Number of Cases Cases Worked yesterday Total $ Spent Priority 1 Designation
    Doe 3 3 26000.00 0
    Obama 1 1 9000.00 1

    The numbers are automatically populated with either a COUNTIF function or a SUMPRODUCT function, depending on the criteria. What I need to do now is get them to calculate based on the "Worker Name" from the main sheet.

    Any ideas?

    Edit: I want to clarify. Some of them are looking things up appropriately while others don't. Here's my current formulas that need help:
    Priority: =COUNTIF('[spreadsheet name]'!I2:I200,"1")
    Cases worked previous day: =SUMPRODUCT(('[spreadsheet name]'!$AD$1:$FS$1=TODAY()-1)*('[spreadsheet name]t'!$AD$1:$FS$2301="√"))
    Last edited by Patty McJorst; 05-10-2013 at 01:15 PM.

  2. #2
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Adding Conditional look up to SUMPRODUCT and COUNTIF

    You need to change your COUNTIF to a SUMPRODUCT (since you have 2003) which includes setting your Worker Name range in 'spreadsheet name' = $A2 Or wherever you have the names. You need to add a similar argument to your SUMPRODUCT. Can't be more specific because I don't know where your cells are.
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,933

    Re: Adding Conditional look up to SUMPRODUCT and COUNTIF

    hi and welcome to the forum

    Try adding an extra condition to your sumproduct....("worker name column"=workername)
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  4. #4
    Registered User
    Join Date
    05-10-2013
    Location
    New York
    MS-Off Ver
    Excel 2010
    Posts
    29

    Re: Adding Conditional look up to SUMPRODUCT and COUNTIF

    Quote Originally Posted by FDibbins View Post
    hi and welcome to the forum

    Try adding an extra condition to your sumproduct....("worker name column"=workername)
    Thanks for the welcome!

    I try to add ('[spreadsheet name]'!$A$1:$A$2301=Obama)), as column A is the worker name using, but I get a name error:

    =SUMPRODUCT((('[spreadsheet name]'!$AD$1:$FS$1=TODAY()-1)*('[spreadsheet name]'!$AD$1:$FS$2301="√"))*('[spreadsheet name]'!$A$1:$A$2301=Obama))

    Quote Originally Posted by ChemistB View Post
    You need to change your COUNTIF to a SUMPRODUCT (since you have 2003) which includes setting your Worker Name range in 'spreadsheet name' = $A2 Or wherever you have the names. You need to add a similar argument to your SUMPRODUCT. Can't be more specific because I don't know where your cells are.
    I have tried to change to a SUMPRODUCT the COUNTIFs, but I think I'm doing something wrong. As for adding the argument in the existing SUMPRODUCTs, I think I might be doing it wrong (see right above your quote).

  5. #5
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Adding Conditional look up to SUMPRODUCT and COUNTIF

    Firstly, Obama would need to be in quotes. However, you probably want to refer to a cell rather than hard coding it like that. Then you can copy it down your sheet (assuming your sheet is organized properly)
    So maybe
    =SUMPRODUCT((('[spreadsheet name]'!$AD$1:$FS$1=TODAY()-1)*('[spreadsheet name]'!$AD$1:$FS$2301="√"))*('[spreadsheet name]'!$A$1:$A$2301=A2)) (Assuming Obama is in A2)

    For the countif

    =SUMPRODUCT(--('[spreadsheet name]'!$I$1:$I$2301 ="1"), --('[spreadsheet name]'!$A$1:$A$2301 = A2))

    If you're having trouble, upload an example spreadsheet showing your layout without confidential information by "Going Advanced" > "Manage Attachments"

  6. #6
    Registered User
    Join Date
    05-10-2013
    Location
    New York
    MS-Off Ver
    Excel 2010
    Posts
    29

    Re: Adding Conditional look up to SUMPRODUCT and COUNTIF

    That worked. I figured out where I was missing a step. Thanks for the help!

  7. #7
    Registered User
    Join Date
    05-10-2013
    Location
    New York
    MS-Off Ver
    Excel 2010
    Posts
    29

    Re: Adding Conditional look up to SUMPRODUCT and COUNTIF

    Actually hit another snag along the way. Same problem as before:

    =SUMPRODUCT(('[spreadsheet name]'!$H$2:$H$200="value1")+('[spreadsheet name]'!$H$2:$H$200="value2")+('[spreadsheet name]'!$H$2:$H$200="value3"))

    So where would I add the *('[spreadsheet name]'!$A$1:$A$2301=A2))? (Obama=A2)

+ 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