+ Reply to Thread
Results 1 to 19 of 19

SUMIFS Formula Problem

  1. #1
    Registered User
    Join Date
    07-28-2014
    Location
    Milton Keynes
    MS-Off Ver
    Excel 2010
    Posts
    14

    SUMIFS Formula Problem

    Hi all,

    Hoping for some help here. I'm trying to write a SUMIFS formula that works on an Excel Table and adds a calculated field based on given criteria including a date field. The current formula is below:

    =SUMIFS(Table1[Daily Charge],Table1[Supply No.],$A4,Table1[Line Type],$B4,Table1[Start Read Date],"<="&C$1,Table1[End Read Date],">="&C$1)

    This isn't giving me the required result and to be honest I can't tell what it is actually giving me... If I change the formula to an array formula as follows:

    {=SUM(Table1[Daily Charge]*(Table1[Supply No.]=$A5)*(Table1[Line Type]=$B5)*(Table1[Start Read Date]<=C$1)*(Table1[End Read Date]>=C$1))}

    Then it works perfectly. The only problem is that I need a lot of these formulae on my sheet and the array formula takes up more memory and more time to compute. Help with the SUMIFS would therefore be greatly appreciated!

    Thanks
    Alex

  2. #2
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: SUMIFS Formula Problem

    have you tried your first formula without the "" around your greater than/less than equal to parts? That can have a formula read that as text instead of functions.
    Make contributors happy, click on the "* Add Reputation" as a way to say thank you.
    Sam Capricci

  3. #3
    Registered User
    Join Date
    07-28-2014
    Location
    Milton Keynes
    MS-Off Ver
    Excel 2010
    Posts
    14

    Re: SUMIFS Formula Problem

    Sorry, do you mean entering as:

    SUMIFS(Table1[Daily Charge],Table1[Supply No.],$A5,Table1[Line Type],$B5,Table1[Start Read Date],<=C$1,Table1[End Read Date],>=C$1)

    If so then I get an error message. I think Excel expects the condition to be entered as 'text' for example if I wanted >0 then I'd have to enter ">0"

  4. #4
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,648

    Re: SUMIFS Formula Problem

    Hi AlexMillington,
    Welcome to the Forum.

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic
    Regards
    sktneer


    Treat people the way you want to be treated. Talk to people the way you want to be talked to.
    Respect is earned NOT given.

  5. #5
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: SUMIFS Formula Problem

    Best guess is that the values in Table1[Daily Charge] are not real numbers.
    They're 'Numbers Stored As Text'

    try copying a blank cell
    Highlight Table1[Daily Charge]
    Right Click - Paste Special - Values - Add - OK

  6. #6
    Registered User
    Join Date
    07-28-2014
    Location
    Milton Keynes
    MS-Off Ver
    Excel 2010
    Posts
    14

    Re: SUMIFS Formula Problem

    Nope, they're definitely real numbers. The problem seems to be with the [Supply No.].

    I just tried desensitising the data and reducing the volume to post a smaller workbook and thought I'd reduce the data to just the supply number I was after and suddenly the right numbers appeared. So it seems that it can tell everything else, just not the supply number.

    The supply number is No. Stored as Text so 008450091200010165884 as an example. It is stored as text in both the data source and the lookup criteria

  7. #7
    Registered User
    Join Date
    07-28-2014
    Location
    Milton Keynes
    MS-Off Ver
    Excel 2010
    Posts
    14

    Re: SUMIFS Formula Problem

    I've just discovered that looking for 008450091200010165884 has picked up 008450091200010165893 as well

    Is this that the text/number string is too long?

  8. #8
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: SUMIFS Formula Problem

    Well it's only going to be guesses at this point.

    Go ahead and post a sample book.

  9. #9
    Registered User
    Join Date
    07-28-2014
    Location
    Milton Keynes
    MS-Off Ver
    Excel 2010
    Posts
    14

    Re: SUMIFS Formula Problem

    Sample workbook attached
    Attached Files Attached Files

  10. #10
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: SUMIFS Formula Problem

    I don't understand what the problem is?

    Both formulas produce the same result.

    In the file you posted, you added the round function to the array version
    =ROUND(SUM(Table1[Daily Charge]*(Table1[Supply No.]=$A2)*(Table1[Line Type]=$B2)*(Table1[Start Read Date]<=C$1)*(Table1[End Read Date]>=C$1)),2)

    This produces the exact same resut.
    =ROUND(SUMIFS(Table1[Daily Charge],Table1[Supply No.],$A2,Table1[Line Type],$B2,Table1[Start Read Date],"<="&C$1,Table1[End Read Date],">="&C$1),2)

  11. #11
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: SUMIFS Formula Problem

    I did just notice that in your original post, the Sumifs formula referenced A4 and B4, but the array formula referenced A5 and B5

    That would explain the different results...

  12. #12
    Registered User
    Join Date
    07-28-2014
    Location
    Milton Keynes
    MS-Off Ver
    Excel 2010
    Posts
    14

    Re: SUMIFS Formula Problem

    Not for all lines it doesn't - or at least it doesn't on my computer!

    It works for the Availability charge but doesn't work for Climate Change Levy or any of the others

  13. #13
    Registered User
    Join Date
    07-28-2014
    Location
    Milton Keynes
    MS-Off Ver
    Excel 2010
    Posts
    14

    Re: SUMIFS Formula Problem

    Sorry, they were just sample formulas to give the principle of what I was trying to do...

  14. #14
    Registered User
    Join Date
    07-28-2014
    Location
    Milton Keynes
    MS-Off Ver
    Excel 2010
    Posts
    14

    Re: SUMIFS Formula Problem

    Note that Availability charge only exists for 008450091200010165884 whereas all other items exist on both 008450091200010165884 and 008450091200010165893

  15. #15
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: SUMIFS Formula Problem

    I see now.
    I mistakenly assumed you had the array formula in all 5 cells in the book you posted.
    But you only had it in C2, C3 to C6 had the sumifs.

    Then my testing in another set of cells using just the sumifs revealed the same results.


    You seem to be right. The sumifs I believe is evaluating only the first 16 digits.
    That is actually not surprising, I thought 16 significant digits was the limit to excel's calculations.
    Not sure why the array version evaluates the whole thing.

  16. #16
    Registered User
    Join Date
    07-28-2014
    Location
    Milton Keynes
    MS-Off Ver
    Excel 2010
    Posts
    14

    Re: SUMIFS Formula Problem

    Me either... And this is stored as text so I would have thought it would have no limit. The SUMIFS must be converting the data to numeric for some reason.

    There is a workaround I've found as there is another identifier that is tied to the supply number but it is only 7 digits long so it works perfectly.

    Thanks for your help on this and perhaps this string will help another confused person in days to come

  17. #17
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: SUMIFS Formula Problem

    Here's an alternate approach, still without entering with CTRL + SHIFT + ENTER

    =ROUND(SUMPRODUCT(Table1[Daily Charge],--(Table1[Supply No.]=$A2),--(Table1[Line Type]=$B2),--(Table1[Start Read Date]<=C$1),--(Table1[End Read Date]>=C$1)),2)

  18. #18
    Registered User
    Join Date
    07-28-2014
    Location
    Milton Keynes
    MS-Off Ver
    Excel 2010
    Posts
    14

    Re: SUMIFS Formula Problem

    Thanks - basically using SUMPRODUCT in replacement of the array. Good to see that formula in action as I've never really committed the time to getting it to work in the past. Does it evaluate quicker than an array formula?

  19. #19
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: SUMIFS Formula Problem

    I honestly couldn't say.
    It's technically still an array formula, you just don't have to enter with CSE.

    I think it would be faster, but probably not much.

+ 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. SUMIFS Problem - A value used in the formula is of the wrong data type
    By TicklyTigger in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-09-2014, 10:48 AM
  2. SUMIFS problem
    By chris-streeter in forum Excel General
    Replies: 6
    Last Post: 10-30-2013, 09:55 AM
  3. [SOLVED] Sumifs, problem with the formula: =sumifs(c10:c200,<=today(),0)
    By Faustocruz in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 10-08-2012, 04:26 AM
  4. Problem whit SUMIFS R1C1 Formula !
    By Petter120 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-12-2012, 09:35 PM
  5. sumifs (i think) formula problem
    By big_nath in forum Excel General
    Replies: 2
    Last Post: 09-30-2011, 09:58 AM

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