+ Reply to Thread
Results 1 to 11 of 11

Sumproduct formula - how to put the criteria together

  1. #1
    Registered User
    Join Date
    03-09-2007
    Posts
    51

    Sumproduct formula - how to put the criteria together

    There are a few formulas which I need help on but the first formula I need is to count invoices within the month but NOT if the word "refund" is displayed in the corresponding cells of column J (J18:J80) or if the word "Paid Acc." is displayed within this same data range (J18:J80)

    I'm guessing the formula will be a sumproduct but I'm not familiar with these and have tried to play around with it but cannot seem to get a proper value returned.

    The formula which is currently being used is a countif formula as follows:

    =SUMPRODUCT((B18:B80<>"")*(J18:J80<>"PAID ACC."))

    Any help would be grately appreciated.

  2. #2
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Hi,

    Try

    =SUMPRODUCT(--(MONTH(B18:B80)=1)*(B18:B80<>"")*(J18:J80<>"Paid Acc.")*(J18:J80<>"refund"))

    Where 1 equals Jan.

    VBA Noob
    Last edited by VBA Noob; 03-25-2007 at 11:30 AM.
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  3. #3
    Registered User
    Join Date
    03-09-2007
    Posts
    51
    Excellent thanks, this works.

    I think I'm getting to grips more with sumproduct formulas now. Does the * within a formula split up the criteria? And also what does the two -- mean at the start of the formula? is this saying that there are multiple criteria within the formula?

  4. #4
    Forum Contributor
    Join Date
    03-14-2006
    Location
    Pakistan
    Posts
    1,791

    Lightbulb

    Quote Originally Posted by Darlo
    Excellent thanks, this works.

    I think I'm getting to grips more with sumproduct formulas now. Does the * within a formula split up the criteria? And also what does the two -- mean at the start of the formula? is this saying that there are multiple criteria within the formula?
    see the link below for explanation

    http://www.mcgimpsey.com/excel/formulae/doubleneg.html

  5. #5
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988

  6. #6
    Registered User
    Join Date
    03-09-2007
    Posts
    51

    sumif, sumproduct or combination of the two

    I can create sumproduct formulas to count and display results when certain criteria is not displayed in the same cells of other columns but basically I need to know how to do a formula that adds totals together when the corresponding cells of another column match a certain criteria.

    i.e. I need to add invoice totals together (E18:E80) but only when the data in F18:F80 displays an "x" but not when the word "Paid account" OR "refund" is displayed in cells J18:J80

    Any ideas? Do i have to combine sumproduct and sumif?
    Last edited by Darlo; 03-26-2007 at 03:53 PM.

  7. #7
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Please don't post duplicates. If you don't get your answer just say so.

    That said try

    =SUMPRODUCT(--(F18:F80="x")*(E18:E80))

    VBA Noob

  8. #8
    Registered User
    Join Date
    03-09-2007
    Posts
    51
    Sorry, I didn't think that they were duplicate posts because at the time I didn't fully understand the sumproduct formula which was given to me. I'm currently reading through the websites you have given me to try and understand them more rather than just copying down functions from here without understanding why and how the function is written.

    From playing around am I right in thinking that to add data which does not include a certain word or phrase you use the <> symbol?

    i.e.

    =SUMPRODUCT((E18:E70)*(J18:J70<>"Paid acc.")) this would only add up the cells which do not contain the word "paid acc."

    whereas;

    =SUMPRODUCT((E18:E70)*(J18:J70="Paid acc.")) would add up the cells which only contained the word "paid acc."

  9. #9
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    That is correct

    VBA Noob

  10. #10
    Registered User
    Join Date
    03-09-2007
    Posts
    51
    Can this rule be transferred to a sumif function?

    I am currently using multiple sumif functions to add up all amounts which have been paid by either visa, mastercard, switch and maestro.

    =SUMIF(I18:I76,"visa",E18:E121)+SUMIF(I18:I121,"m/card",E18:E121)+SUMIF(I18:I121,"maestro",E18:E121)+SUMIF(I18:I121,"switch",E18:E121)

    I need to add another criteria so that it will only add these up aslong as "refund" is not displayed in J18:J121. I have tried to add another sumif using the <> but it does not seem to work and when I have tried to use the sumproduct function it is returning a £0.00 value as though it is looking for all the arrays within the same cell.

    Any help or ideas would be greatly appreciated.

  11. #11
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Hi,

    You must have the same range in sumproduct. So i've changed I18:I76 to I18:I121

    Try this amended one

    =SUMPRODUCT(--(I18:I121={"visa","m/card","maestro","switch"})*(J18:J121<>"refund")*(E18:E121))

    VBA Noob

+ 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