+ Reply to Thread
Results 1 to 14 of 14

SUMIFS error on criteria range with leading zero text

  1. #1
    Registered User
    Join Date
    10-01-2024
    Location
    Denmark
    MS-Off Ver
    365
    Posts
    6

    SUMIFS error on criteria range with leading zero text

    The formula result in cell B7 of?*=SUMIFS(B1:B3, A1:A3, "06") is 7, while it should be 2...

    The same problem with COUNTSIFS.

    A possible tweak to the wrong result, is to add a letter in front of the leading zero texts (eg. "V006", "V06" and "V6" in the range A1:A3).
    Attached Files Attached Files

  2. #2
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,990

    Re: SUMIFS error on criteria range with leading zero text

    Yes, those functions will coerce the values to numbers, so 006, 06 and 6 will all be treated the same. You can use SUMPRODUCT instead:

    =SUMPRODUCT(B3:B5*(A3:A5="06"))

    or, since you have 365:

    =SUM(FILTER(B3:B5,A3:A5="06"))
    Everyone who confuses correlation and causation ends up dead.

  3. #3
    Registered User
    Join Date
    10-01-2024
    Location
    Denmark
    MS-Off Ver
    365
    Posts
    6

    Re: SUMIFS error on criteria range with leading zero text

    Hi romperstomper.

    Thank for the quick reply, and the nice suggestion to use SUM and FILTER instead. Works fine. :-)

    Just say that the SUMIFS is not corrected by MS...

    /Søren

  4. #4
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,990

    Re: SUMIFS error on criteria range with leading zero text

    I doubt that will be changed as that is the way it has always worked, and there are bound to be lots of people using it on the assumption it will continue to do just that.

  5. #5
    Forum Expert avk's Avatar
    Join Date
    07-12-2007
    Location
    India
    MS-Off Ver
    Microsoft Office 2013
    Posts
    3,279

    Re: SUMIFS error on criteria range with leading zero text

    Also try this
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    "A9" is criteria as 06
    Last edited by avk; 10-01-2024 at 07:04 AM. Reason: add


    atul


    If my answer (or that of other members) has helped you, please say "Thanks" by clicking the Add Reputation button at the foot of one of their posts.

    Also: if your problem is solved, please take the time to mark your thread as SOLVED by going to the top of your first post, selecting "Thread Tools" and then "Mark thread as solved".

  6. #6
    Forum Expert wk9128's Avatar
    Join Date
    08-15-2020
    Location
    China Shanghai
    MS-Off Ver
    365 V2503 and WPS V2024(12.1.0.18543)
    Posts
    3,917

    Re: SUMIFS error on criteria range with leading zero text

    Cell B7 formula

    Formula: copy to clipboard
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    10-01-2024
    Location
    Denmark
    MS-Off Ver
    365
    Posts
    6

    Re: SUMIFS error on criteria range with leading zero text

    Hi wk9128. I guess this approach is not generally useful - at least I have not been able to tweak this to also give me the SUM of the criteria is just the '6 (resulting in the SUM being 4). But thanks anyway.

  8. #8
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    90,759

    Re: SUMIFS error on criteria range with leading zero text

    If that takes care of your original question, please choose Thread Tools from the menu link above and mark this thread as SOLVED. You can also access the SOLVED tag by editing the opening post and choosing SOLVED from the drop-down to the left of the title box.

    Also, if you have not already done so, remember that you can reward anyone who offered you help towards a solution for your issue by clicking the small star icon (* Add Reputation) located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of each of those who offered help.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  9. #9
    Registered User
    Join Date
    10-01-2024
    Location
    Denmark
    MS-Off Ver
    365
    Posts
    6

    Re: SUMIFS error on criteria range with leading zero text

    Quote Originally Posted by avk View Post
    Also try this
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    "A9" is criteria as 06
    Hi and thanks for the reply. It works, but only if there is only one occurrence of '06 in the range...

  10. #10
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    90,759

    Re: SUMIFS error on criteria range with leading zero text

    You have solutions in post #2. Please see post #8.

  11. #11
    Registered User
    Join Date
    10-01-2024
    Location
    Denmark
    MS-Off Ver
    365
    Posts
    6

    Re: SUMIFS error on criteria range with leading zero text

    Quote Originally Posted by romperstomper View Post
    I doubt that will be changed as that is the way it has always worked, and there are bound to be lots of people using it on the assumption it will continue to do just that.
    If MS do not want to change this for compatibility reasons, then MS could add an optional parameter with something like "Exact text comparison" to make the SUMIFS and COUNTIFS more "Exact"... (the same way as the VLOOKUP needs a 4th argument FALSE to have an exact match). Thanks again.

  12. #12
    Registered User
    Join Date
    10-01-2024
    Location
    Denmark
    MS-Off Ver
    365
    Posts
    6

    Re: SUMIFS error on criteria range with leading zero text

    Quote Originally Posted by AliGW View Post
    You have solutions in post #2. Please see post #8.
    Thanks. I will do that later, just want to see if there are other good reply's.

  13. #13
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    90,759

    Re: SUMIFS error on criteria range with leading zero text

    If you are waiting for a SUMIF(S) version, then you will be waiting for a long time.

    Please let us know what it is about the two succinct and effective solutions you have already that you feel may not be quite good enough so that we know what you are hoping to see.

    If MS do not want to change this for compatibility reasons, then MS could add an optional parameter with something like "Exact text comparison" to make the SUMIFS and COUNTIFS more "Exact"... (the same way as the VLOOKUP needs a 4th argument FALSE to have an exact match).
    They could, but you'd need to lobby them. I presume you realise that we aren't affiliated with MS in any way?

  14. #14
    Forum Expert wk9128's Avatar
    Join Date
    08-15-2020
    Location
    China Shanghai
    MS-Off Ver
    365 V2503 and WPS V2024(12.1.0.18543)
    Posts
    3,917

    Re: SUMIFS error on criteria range with leading zero text

    I don't know why, but the result here is correct
    If not, you can use this =SUMPRODUCT(B3:B5*(A3:A5="06"))
    Attached Images Attached Images

+ 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. Replies: 1
    Last Post: 04-09-2021, 11:09 AM
  2. [SOLVED] Usine sumifs to change criteria range column based on dynamic criteria
    By Luiscarlos in forum Excel General
    Replies: 5
    Last Post: 11-19-2020, 09:33 AM
  3. SUMIFS for date range (read from a cell) and text criteria not working
    By meny_ in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 05-03-2019, 06:23 AM
  4. [SOLVED] SUMIFS with multiple criteria WITH specified dynamic range criteria
    By dluhut in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 01-20-2017, 11:03 AM
  5. Replies: 5
    Last Post: 10-03-2016, 03:39 AM
  6. Replies: 3
    Last Post: 11-21-2012, 04:57 PM
  7. Replies: 1
    Last Post: 05-16-2011, 05:00 PM

Tags for this Thread

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