+ Reply to Thread
Results 1 to 5 of 5

If/Sumproduct Combo

Hybrid View

  1. #1
    Forum Contributor day92's Avatar
    Join Date
    04-20-2010
    Location
    Los Angeles
    MS-Off Ver
    Excel 360
    Posts
    600

    If/Sumproduct Combo

    Is it possible to do a IF/Sumproduct statement?

    Im trying to pull data from a sheet for a certain Dr in a certain month for a certain vendor.

    Here is the formula I tried but it is not working. Attached is the sheet im using. The formula is in B13 to B21. It should only return values for two of the vendors which are highlighted.

    =IF(Database!A:A=Gray!B5,SUMPRODUCT((Database!$B:$B=A13)*(Database!$G:$G=$B$5),(Database!$C:$C)),"")
    Attached Files Attached Files
    Last edited by day92; 06-16-2011 at 06:34 PM.

  2. #2
    Forum Contributor day92's Avatar
    Join Date
    04-20-2010
    Location
    Los Angeles
    MS-Off Ver
    Excel 360
    Posts
    600

    Re: If/Sumproduct Combo

    Figured it out.

  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,311

    Re: If/Sumproduct Combo

    Just use SUMPRODUCT

    See the attached updated spreadsheet.


    Edit: I would recommend that you do NOT use SUMPRODUCT on entire columns although it is "acceptable" in Excel 2007/2010


    Regards
    Attached Files Attached Files
    Last edited by TMS; 06-16-2011 at 07:06 PM.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  4. #4
    Valued Forum Contributor
    Join Date
    07-17-2005
    Location
    Abergavenny, Wales, UK
    MS-Off Ver
    XL2003, XL2007, XL2010, XL2013, XL2016
    Posts
    608

    Re: If/Sumproduct Combo

    HI

    Firstly, although XL2007 and XL2010 will take a full column as a range in Sumproduct formulae - it is to be avoided.
    With over 1 million rows in a column, all SP formulae will become very slow.

    Instead, create a Table as I have in the attached workbook
    Delete all your blank rows in the data base.
    Place cursor within table >Insert tab>Table>my data has headers.
    The size of he table will grow dynamically as you add more data.

    Then you can refer to the table header name in the formulae

    CODE
    in cell B13
    =SUMPRODUCT((Table1[Vendor Name]=$A13)*(Table1[MONTH]=B$5)*(Table1[Doctor]=$B$1),(Table1[PO Amount]))

    and copy down with the fill handle.
    Then copy B13:B1, select C13:M13 and Paste Special>Formulas
    (You cannot drag fill table formulae across the page.)

    IN cell B6
    =SUMPRODUCT((Table1[MONTH]=B$5)*(Table1[Doctor]=$B$1),(Table1[PO Amount]))
    copy formula across

    In cell B7
    =IFERROR(AVERAGEIF(Table1[MONTH],Jafari!B$5,Table1[PO Amount]),0)

    I also created a unique list of Doctors on sheet Database, and set up Data Validation in cell B1 of sheet Jafari to enable you to easily select a different doctor to see his results.
    Attached Files Attached Files
    --
    Regards
    Roger Govier
    Microsoft Excel MVP

  5. #5
    Forum Contributor day92's Avatar
    Join Date
    04-20-2010
    Location
    Los Angeles
    MS-Off Ver
    Excel 360
    Posts
    600

    Re: If/Sumproduct Combo

    Roger - thanks for the information, I will give that a shot. It did start to run a little slow so that may be the way to go.

    Thanks again!

+ 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