+ Reply to Thread
Results 1 to 15 of 15

SUMIF formula error with Array

  1. #1
    Registered User
    Join Date
    08-03-2015
    Location
    Carson, CA
    MS-Off Ver
    2010
    Posts
    8

    SUMIF formula error with Array

    Hi there,

    I'm trying to create a formula that will provide a total cost based on number of items within a range. I have a formula in my file but it is not returning the correct total. Ultimately each quantity threshold will have a different rate.

    # OF ITEMS RATE PER ITEM
    1,000,000 $40.00
    2,000,000 $40.00
    3,000,000 $40.00
    4,000,000 $40.00
    5,000,000 $40.00
    6,000,000 $40.00
    0

    ITEM # COST
    4,678,910 $147,156,400.40

    What the total should be $187,156,400.00

    Delta/Variance $39,999,999.60

    =SUM(IF(IF(A$17>=A7:A12,A7:A12-A6:A11,A$17-A6:A11+0.01)>0,IF(A$17>=A7:A12,A7:A12-A6:A11,A$17-A6:A11+0.01)*B6:B11))

    Please let me know if you need any further information.

    Thank you for any help you can provide, I greatly appreciate it.
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,559

    Re: SUMIF formula error with Array

    There are some problems with the spreadsheet as set up. For one there is a circular reference in B10 where the formula entered is
    Please Login or Register  to view this content.
    You could solve this by selecting B6 and filling down. Then in cell B17 there is a formula
    Please Login or Register  to view this content.
    where A$21 is a cell that contains text as opposed to a value. It seems that a formula that multiplies A17 by either a VLOOKUP or INDEX/MATCH formula which refers to B6:B11 is needed in B17. One thing that needs to be clarified is whether the rate per item will be for the next higher or next lower # of items.
    Last edited by JeteMc; 08-05-2015 at 02:17 PM. Reason: clarification

  3. #3
    Registered User
    Join Date
    08-03-2015
    Location
    Carson, CA
    MS-Off Ver
    2010
    Posts
    8

    Red face Re: SUMIF formula error with Array

    Thank you for your help. I have corrected the circular reference and updated the sheet to include different rates by increment.Please see attached updated file for clarification and let me know if you have further questions.
    Attached Files Attached Files

  4. #4
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,559

    Re: SUMIF formula error with Array

    Which "Total" is correct? Post #1 says $147,156,400.40 but the file attached to post #3 says $143,578,200.00

  5. #5
    Registered User
    Join Date
    08-03-2015
    Location
    Carson, CA
    MS-Off Ver
    2010
    Posts
    8

    Re: SUMIF formula error with Array

    Sorry for the confusion; Post #3 has the correct total since I updated the spreadsheet to include different values based on quantities.

  6. #6
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,559

    Re: SUMIF formula error with Array

    To get that total you might do better to use your "Break down" table. Your formulas in column E will work, however they contain an un-needed +. Putting this formula
    Please Login or Register  to view this content.
    in D6 will get your started (note that you'll have to modify it for cells D7 and down)

  7. #7
    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: SUMIF formula error with Array

    Why not just this....
    =SUMPRODUCT(D6:D10,B6:B10)
    No need for the interim calcs
    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

  8. #8
    Registered User
    Join Date
    08-03-2015
    Location
    Carson, CA
    MS-Off Ver
    2010
    Posts
    8

    Re: SUMIF formula error with Array

    Thank you! I've done that temporarily, but I'm really trying to come up with a formula that gives me the total cost based on a plugged quantity. So if I have 2,500,000, it will multiply the 1st million to the $40, the 2nd million to $35 and the remaining 500k to $30. Does this make sense?

  9. #9
    Registered User
    Join Date
    08-03-2015
    Location
    Carson, CA
    MS-Off Ver
    2010
    Posts
    8

    Re: SUMIF formula error with Array

    Thank you! The Break down table will not be in the file, I was using it to explain what I'm trying to accomplish. I want to be able to plug in a quantity to cell A17 and have it automatically calculate. So if I have 2,500,000, it will multiply the 1st million to the $40, the 2nd million to $35 and the remaining 500k to $30. Does this make sense?

  10. #10
    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: SUMIF formula error with Array

    So the table in A5"B11 wont exist either?

  11. #11
    Registered User
    Join Date
    08-03-2015
    Location
    Carson, CA
    MS-Off Ver
    2010
    Posts
    8

    Re: SUMIF formula error with Array

    That table will remain.

  12. #12
    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: SUMIF formula error with Array

    OK, can you add a helper column - which can be hidden - to give you what you have in D6? Something like this...
    A
    B
    C
    5
    # OF ITEMS
    Helper
    RATE PER ITEM
    6
    1,000,000
    1,000,000
    $ 40.00
    7
    2,000,000
    1,000,000
    $ 35.00
    8
    3,000,000
    1,000,000
    $ 30.00
    9
    4,000,000
    1,000,000
    $ 25.00
    10
    5,000,000
    678,910
    $ 20.00
    11
    $ 20.00
    12
    $ 143,578,200.00

    A6= 1 000 000
    A7=IF(A6>$A$17,"",A6+1000000)
    copied down

    B6=IF(A6="","",IF(ISTEXT(A5),A6,IF(A6>$A$17,$A$17-A5,A6-A5)))
    copied down
    This column can be hidden

    C12=SUMPRODUCT(B6:B11,C6:C11)
    You can put this wherever you want it

  13. #13
    Registered User
    Join Date
    08-03-2015
    Location
    Carson, CA
    MS-Off Ver
    2010
    Posts
    8

    Re: SUMIF formula error with Array

    This is Awesome!!! One exception though! If I input 10m, it's not working. What do I need to change in A11 or B11 so that anything > 6m is = to $20?

  14. #14
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,559

    Re: SUMIF formula error with Array

    I am sure that there are many fine solutions that would give you an answer. I am simply going back to your "Break down table" (which can be hidden) because, having designed it, you are familiar with how it works. As stated above populate D6 with
    Please Login or Register  to view this content.
    then D7:D10 with
    Please Login or Register  to view this content.
    Slide your Totals cells down one row and populate D11 with
    Please Login or Register  to view this content.
    One change will be needed for the formulas in column E which is if the corresponding cell in column D is empty then the cell in column E is also empty as so
    Please Login or Register  to view this content.
    I am attaching your file with the above mentioned changes:
    Copy of Sumif problem-2.xlsx
    Let me know if you have any questions.

  15. #15
    Registered User
    Join Date
    08-03-2015
    Location
    Carson, CA
    MS-Off Ver
    2010
    Posts
    8

    Re: SUMIF formula error with Array

    Thank you very much! This will definitely be the alternative if I can't get the other formula to work appropriately. It's almost there..... Thank you again for your help!!!!

+ 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. Sumif formula on an array of criteria?
    By Dial1 in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 08-07-2013, 05:29 PM
  2. SumIf or array formula
    By zachvu in forum Excel General
    Replies: 11
    Last Post: 06-22-2010, 04:45 PM
  3. Array Formula with Sumif and between dates
    By Neil Glazin in forum Excel General
    Replies: 13
    Last Post: 01-15-2010, 11:27 AM
  4. Sumproduct, Sumif, or Array Formula?
    By ExcelQuestion in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-24-2007, 07:16 PM
  5. [SOLVED] Array Formula w/ Multiple SumIf Criteria
    By Bob Phillips in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 09-06-2005, 07:05 AM
  6. Array Formula w/ Multiple SumIf Criteria
    By Andy in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-05-2005, 10:05 PM
  7. Modify SumIF... Array Formula
    By carl in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-17-2005, 03:06 PM
  8. [SOLVED] RE: Modify SumIF... Array Formula
    By Peo Sjoblom in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 05-17-2005, 02:06 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