+ Reply to Thread
Results 1 to 18 of 18

Adding 2 products

  1. #1
    Registered User
    Join Date
    07-18-2011
    Location
    Wales
    MS-Off Ver
    Excel 2007
    Posts
    13

    Adding 2 products

    HI All,

    Can someone tell me how I would or even could add 2 products to the below formula. I wish to include "Electricity" and one other.


    =SUMPRODUCT(--(Expenses!A1:A590>=DATE(2013,4,6)),--(Expenses!A1:A590<=DATE(2013,4,30)),--(Expenses!F1:F590="Electricity"),Expenses!D1:D590)

    Thanks very much

    Rich

  2. #2
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Adding 2 products

    Hi

    ...I wish to include "Electricity" and one other.
    The other one is in the same column as Electricity? or in another column?
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

  3. #3
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Adding 2 products

    =SUMPRODUCT(--(Expenses!A1:A590>=DATE(2013,4,6)),--(Expenses!A1:A590<=DATE(2013,4,30)),--(Expenses!F1:F590="Electricity")+(Expenses!F1:F590="something else"),Expenses!D1:D590)
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  4. #4
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Adding 2 products

    Since you are using Excel 2007 use sumifs instead of sumproduct....


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  5. #5
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,450

    Re: Adding 2 products

    Quote Originally Posted by :) Sixthsense :) View Post
    Since you are using Excel 2007 use sumifs instead of sumproduct....
    Does SUMIFS bring some added value compared to SUMPRODUCT ?

  6. #6
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Adding 2 products

    Quote Originally Posted by Pepe Le Mokko View Post
    Does SUMIFS bring some added value compared to SUMPRODUCT ?
    Yes... It runs faster than sumproduct

  7. #7
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Adding 2 products

    you cant just use sumifs with OR you need to sum the sumifs
    =SUM(SUMIFS(expenses!D1:D590,expenses!A1:A590,">="&DATE(2013,4,6),expenses!A1:A590,"<="&DATE(2013,4,30),expenses!F1:F590,{"electricity","something else"}))

  8. #8
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Adding 2 products

    Quote Originally Posted by martindwilson View Post
    you cant just use sumifs with OR you need to sum the sumifs
    Of course because of using criteria values in array... otherwise no need for it

  9. #9
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Adding 2 products

    =SUMIFS(expenses!D1:D590,expenses!A1:A590,">="&DATE(2013,4,6),expenses!A1:A590,"<="&DATE(2013,4,30),expenses!F1:F590,"electricity",expenses!F1:F590,"something else") doesnt work
    Attached Files Attached Files
    Last edited by martindwilson; 08-27-2013 at 07:18 AM.

  10. #10
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Adding 2 products

    Quote Originally Posted by martindwilson View Post
    =SUMIFS(expenses!D1:D590,expenses!A1:A590,">="&DATE(2013,4,6),expenses!A1:A590,"<="&DATE(2013,4,30),expenses!F1:F590,"electricity",expenses!F1:F590,"something else") doesnt work
    Yes surely it won't work because the condition is considered as AND Operation on the same range. As you are aware there will not be any possibility/probability which cannot occur because cell can't have Two Complete text on the same cell.

    Again you are very much aware that using the criteria within array {} is considered as OR but the one which you shown which operates as AND

    So it is not the right example to discuss I believe

  11. #11
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Adding 2 products

    well what do you think it should be?

  12. #12
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Adding 2 products

    Assume that the cell entries are like this
    electricity and something else
    gas
    electricity and something else
    electricity

    By using the formula in this way which will get the expected result
    =SUMIFS(expenses!D1:D590,expenses!A1:A590,">="&DATE(2013,4,6),expenses!A1:A590,"<="&DATE(2013,4,30),expenses!F1:F590,"*electricity*",expenses!F1:F590,"*something else*")

    I just wanted to confirm you that the formula posted in Post #9 (In the body of the post) is not the right method of usage because Two Complete text cannot be matched on single range.

  13. #13
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Adding 2 products

    that doesnt work if used in my attached workbook it gives 0
    Attached Files Attached Files

  14. #14
    Registered User
    Join Date
    07-18-2011
    Location
    Wales
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: Adding 2 products

    Quote Originally Posted by martindwilson View Post
    that doesnt work if used in my attached workbook it gives 0
    I can conform that my data is coming from an attached workbook

  15. #15
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Adding 2 products

    ah an assumption ... electricity and something else in the same cell,i read it as electricity OR something else in each cell
    the op needs to specify what's in each cell

    pogo.stix attach a sample workbook

  16. #16
    Registered User
    Join Date
    07-18-2011
    Location
    Wales
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: Adding 2 products

    Quote Originally Posted by martindwilson View Post
    ah an assumption ... electricity and something else in the same cell,i read it as electricity OR something else in each cell
    the op needs to specify what's in each cell

    pogo.stix attach a sample workbook
    As much as I would like to the workbook has 45 pages and has some sensitive personal details included. Posting it would contravene Data Protection.

  17. #17
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Adding 2 products

    hmm you can always make a mock up with fictitious data anyway we only need to see a column with dates a column with text and a column to sum ie the columns you need to use in the formula

  18. #18
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Adding 2 products

    Quote Originally Posted by martindwilson View Post
    ah an assumption ... electricity and something else in the same cell,i read it as electricity OR something else in each cell
    Thanks for the understanding

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Formula to work out how many products among various products!
    By MissConfussed in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 05-02-2013, 02:24 PM
  2. Products to Order
    By WDC3 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-25-2012, 12:33 PM
  3. sum of mutliple products
    By JR573PUTT in forum Excel General
    Replies: 6
    Last Post: 02-28-2007, 07:08 PM
  4. Adding Products
    By carsch in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-28-2006, 12:10 AM
  5. [SOLVED] Products
    By Gene in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-20-2005, 08:07 PM

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