+ Reply to Thread
Results 1 to 36 of 36

SUMIF with text - Excel does not sum range?!

  1. #1
    Registered User
    Join Date
    01-16-2013
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    24

    SUMIF with text - Excel does not sum range?!

    Hi,

    I am trying to SUMIF some statistics in a column when the range contains a certain two-letter abbreviation.


    My equation is as follows =SUMIF(Y409:Y3, "MC", AA409:AA3)

    This should be simple enough, sum the figures in cells AA409:AA3 if the range (Y409:Y3) contains the words "MC" or similar two letter abbreviation.

    Any ideas why excel is displaying the error?

    Many thanks!

  2. #2
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: SUMIF with text - Excel does not sum range?!

    what is the error? note normally you would write
    =SUMIF(Y3:Y409,"MC", AA3:AA409)
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  3. #3
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: SUMIF with text - Excel does not sum range?!

    It seems like you have one or both of the following issues with the data:
    • The MC values have trailing spaces...resulting in a non-match
    • The Col_AA "numbers" are actually numeric text.

    Try entering MC into a Col_Y cell and a number in the corresponding Col_AA cell.
    If your formula returns the value, then we've narrowed the problem.

    Let us know what you find.
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

  4. #4
    Registered User
    Join Date
    01-16-2013
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    24

    Re: SUMIF with text - Excel does not sum range?!

    Hi Ron,

    There are indeed trailing spaces...could that be what is causing the problem?

    I am getting a HASHNUM! error as my equation return.

    The Y Column is populated with two letter abbreviations for each project. The AA column is strictly numerical however a value is only returned in this column depending criteria based on several other associated equations....if this makes sense?

    There are as you suggested, trailing spaces between the rows.

    Chris


    Thank you both for your help!

  5. #5
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: SUMIF with text - Excel does not sum range?!

    do you have #NUM error values in column AA?

  6. #6
    Registered User
    Join Date
    01-16-2013
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    24

    Re: SUMIF with text - Excel does not sum range?!

    Quote Originally Posted by JosephP View Post
    do you have #NUM error values in column AA?
    Hi Joseph,

    Yes there are a number of cells where HashNum errors are displayed in AA column (Where formula in cell has not returned a value) however I want all numbers in AA column that are displayed to be summed?
    Last edited by CMP.1; 01-16-2013 at 12:15 PM.

  7. #7
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: SUMIF with text - Excel does not sum range?!

    use
    =SUMIFS(AA3:AA409,AA3:AA409,"<>#NUM!",Y3:Y409, "MC")
    or if you have trailing spaces after the MC
    =SUMIFS(AA3:AA409,AA3:AA409,"<>#NUM!",Y3:Y409, "MC*")

  8. #8
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: SUMIF with text - Excel does not sum range?!

    Here are 2 suggestions:
    1) Edit the Col_AA formulas to prevent errors (replacing them with 0's)
    2) Either clear the trailing Col_YY spaces OR use this formula: =SUMIF(Y3:Y409, "MC*", AA3:AA409)

    Does that help?

  9. #9
    Registered User
    Join Date
    01-16-2013
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    24

    Re: SUMIF with text - Excel does not sum range?!

    Hi Ron, Joseph,

    Unfortunately as the stats in each cell of column AA (and so on ie AB, AC) each have their own formula that generates a value owing to certain criteria, then I cannot replace them with 0's.

    @Joseph - Both of those equations seemed to start pulling values but it did not sum all the values required from Column AA?

    Thank you both for your help, I really appreciate this.

    Chris

  10. #10
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: SUMIF with text - Excel does not sum range?!

    do you perhaps have leading as well as trailing spaces in the MC data column? if so use "*MC*" as the criteria

  11. #11
    Registered User
    Join Date
    01-16-2013
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    24

    Re: SUMIF with text - Excel does not sum range?!

    Alas I have tried using the Wild Card option! The Sum of the values is still too small..which suggests that some values are not being counted?

  12. #12
    Registered User
    Join Date
    01-16-2013
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    24

    Re: SUMIF with text - Excel does not sum range?!

    When I try a simple SUM function on a couple of cells in the AA column that are populated with numbers/values and not just #NUM! I still get the response #NUM!....does this help explain anything?

  13. #13
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: SUMIF with text - Excel does not sum range?!

    No....but attaching a sample workbook that demonstrates your issue would help
    Can you do that?

  14. #14
    Registered User
    Join Date
    01-16-2013
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    24

    Re: SUMIF with text - Excel does not sum range?!

    Hi,

    I have cut out a small portion of the S/S, this includes the range/criteria I want met in order to sum, the sum range, and the date cells that in this instance are irrelevant, but form part of the wider equation that dictates whether the BLUE columns generate a count/number.

    Hopefully this helps....as I have another 399 cells of this sheet above to sum.....and I cannot run any risk solver scenarios until they are!

    Much appreciated,

    Chris
    Attached Files Attached Files

  15. #15
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: SUMIF with text - Excel does not sum range?!

    Chris...The original formula you posted: =SUMIF(Y409:Y3, "MC", AA409:AA3) references cells that are out of the used range of the workbook you posted. Also, you've purged so much information from that workbook and left so many broken formulas that I can't figure out what you're trying to do. Any chance that you can clean it up a bit and put in the values you hope to see?

  16. #16
    Registered User
    Join Date
    01-16-2013
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    24

    Re: SUMIF with text - Excel does not sum range?!

    Hi Ron,


    I have attached a slightly larger sample. I cannot attach much more I am afraid but you get the gist of what I am trying to do here.


    The Blue column is populated by a number (usually 1-5) however this is dependent on a date.

    You will see the blue column is populated by IF formulas (The missing/broken part will be a cell which says JAN 13) which forms part of the Orange date columns.

    I want to be able to Total/SUM the blue column and its Constituents IE all the total for those populated with MC and GW and etc.

    Does this help?

    Many thanks once again!
    Attached Files Attached Files

  17. #17
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: SUMIF with text - Excel does not sum range?!

    This regular formula returns the sum of Col_X values
    when:
    ...Col_W is either GW or MC
    ...and Col_X is >=0
    W7: =SUM(SUMIFS(X2:X25,V2:V25,{"GW","MC"},X2:X25,">=0"))

    Is that something you can work with?

  18. #18
    Registered User
    Join Date
    01-16-2013
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    24

    Re: SUMIF with text - Excel does not sum range?!

    Hi Ron,

    Thank you for your response,

    I have applied the formula to my spreadsheet, as I just wish to return the sum of the individual cells in each column which belong to MC and the same for GW (and many many more!)

    I have applied your formula which looks like this now:

    =SUM(SUMIFS(AA3:AA410,Y3:Y410,{"MC"},AA3:AA410,">=0"))

    To return the values that are >0 (forgot about that one) however it still returns with the wrong sum?

  19. #19
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: SUMIF with text - Excel does not sum range?!

    Data examples that exhibit the problem, Chris...that's what we need

  20. #20
    Registered User
    Join Date
    01-16-2013
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    24

    Re: SUMIF with text - Excel does not sum range?!

    Ok,


    Another tract - When I try to simply add up the numbers >0 in the blue columns, I still get either A) #NUM! or B) It adds SOME of the numbers but the true total.

    I have attached the top portion of my spreadsheet - For example, I want to Sum (Seen at the bottom) all the numbers in column AA that are related to MC....Yet I always receive the same error?
    Attached Files Attached Files

  21. #21
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: SUMIF with text - Excel does not sum range?!

    Using your latest workbook (Sample 3.xlsx)
    this regular formula begins the sums
    AA23: =SUMIFS(AA$3:AA$19,$Y$3:$Y$19, "MC",AA$3:AA$19,">0")

    Copy that formula across through AL23

    These will be the displayed values:
    2.5 2.5 1.5 1.5 1.5 0 0 0 1.5 0 0 0

    Does that help?

  22. #22
    Registered User
    Join Date
    01-16-2013
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    24

    Re: SUMIF with text - Excel does not sum range?!

    Hi Ron,

    Yes that worked out well on my sample......the problem is when I transfer it to my main spreadsheet and alter the values to reflect the ranges AA3:AA411 and Y3:Y411 etc it still fails to show the correct sum?

    Perhaps If I attach the entire spreadsheet (I apologise for being such a pain) maybe you might be able to spot where the bug lies?

    Thank you very much for your help Ron
    Attached Files Attached Files

  23. #23
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: SUMIF with text - Excel does not sum range?!

    you haven't made the correct ranges absolute. in AA418 enter
    =SUMIFS(AA$3:AA$411,AA$3:AA$411,"<>#NUM!",$Y$3:$Y$411, "*"&$X418&"*")
    then copy across and down

  24. #24
    Registered User
    Join Date
    01-16-2013
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    24

    Re: SUMIF with text - Excel does not sum range?!

    Quote Originally Posted by JosephP View Post
    you haven't made the correct ranges absolute. in AA418 enter
    =SUMIFS(AA$3:AA$411,AA$3:AA$411,"<>#NUM!",$Y$3:$Y$411, "*"&$X418&"*")
    then copy across and down
    Hi Joseph,

    Thank you for your response....I have done as you have said however the sum is still incorrect....the AA1 column for MC alone should have a total of around 5.5?

    Any ideas?


    Many thanks,

    Chris

  25. #25
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: SUMIF with text - Excel does not sum range?!

    some of the numbers in column Z are actually stored as text-if you convert them all to numbers the sums work

  26. #26
    Registered User
    Join Date
    01-16-2013
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    24

    Re: SUMIF with text - Excel does not sum range?!

    Quote Originally Posted by JosephP View Post
    some of the numbers in column Z are actually stored as text-if you convert them all to numbers the sums work
    Forgive me if I have missed a trick, the formula does not take reference from Z?

    Thanks,

    Chris

  27. #27
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: SUMIF with text - Excel does not sum range?!

    the formula in the AA column does ;-)

  28. #28
    Registered User
    Join Date
    01-16-2013
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    24

    Re: SUMIF with text - Excel does not sum range?!

    Quote Originally Posted by JosephP View Post
    the formula in the AA column does ;-)
    Apologies! Yes it does, however I have formatted the entire column to number however sum is still incorrect....can I ask what number It returns for you (for MC) in column AA?

    Thank you!

  29. #29
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: SUMIF with text - Excel does not sum range?!

    changing format does not affect what is stored. you need to convert the numbers in column Z into real numbers-for instance by formatting the cells as general then copying a blank cell and paste special-values-add over the column Z data

    see attached
    Attached Files Attached Files
    Last edited by JosephP; 01-18-2013 at 07:53 AM.

  30. #30
    Registered User
    Join Date
    01-16-2013
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    24

    Re: SUMIF with text - Excel does not sum range?!

    Quote Originally Posted by JosephP View Post
    changing format does not affect what is stored. you need to convert the numbers in column Z into real numbers-for instance by formatting the cells as general then copying a blank cell and paste special-values-add over the column Z data

    see attached

    Joseph,

    Thank you so much for your help on this, this has helped me massively!! Such a relief to get this out of the way. I have learnt a lot from this!

  31. #31
    Registered User
    Join Date
    01-16-2013
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    24

    Re: SUMIF with text - Excel does not sum range?!

    Quote Originally Posted by JosephP View Post
    changing format does not affect what is stored. you need to convert the numbers in column Z into real numbers-for instance by formatting the cells as general then copying a blank cell and paste special-values-add over the column Z data

    see attached

    Joseph,

    Thank you so much for your help on this, this has helped me massively!! Such a relief to get this out of the way. I have learnt a lot from this!

  32. #32
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: SUMIF with text - Excel does not sum range?!

    you're welcome :-)

    please don't forget to mark the thread solved (click the 'thread tools' link at the top, then 'mark solved')

  33. #33
    Registered User
    Join Date
    01-16-2013
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    24

    Re: SUMIF with text - Excel does not sum range?!

    Noted!

    Thank you once again for your help and thank you to Ron as well.

    Chris

  34. #34
    Registered User
    Join Date
    01-16-2013
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    24

    Re: SUMIF with text - Excel does not sum range?!

    Hi Joseph, Ron,


    VERY Sorry to come back to you on this, Everything appeared to work and with your help, I thought I had de bugged this!

    I have put dates in L29:L31 and Values to be counted in Z29:Z31

    These values that are counted show up in the correct date tabs furtheralong (AL29, AM29 & AN29) and so on....HOWEVER these sums (100 just for ease) have not been summed at the bottom? Under MC?

    If you could cast your eye over this (if it is simple) I would be very grateful once again!

    Thanks,

    Chris
    Attached Files Attached Files

  35. #35
    Registered User
    Join Date
    01-16-2013
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    24

    Re: SUMIF with text - Excel does not sum range?!

    I took on board the comments about formatting the cells, and then pasting special values, however is there a way to run the sheet and have the totals sum from Rows AA:BJ without doing this?

    Eventually I would like this to flexible to accommodate different values and sums as this S/S will be used by other people!

    Thank you once again,

    Chris

  36. #36
    Registered User
    Join Date
    01-16-2013
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    24

    Re: SUMIF with text - Excel does not sum range?!

    Hi Joseph,Ron,

    Please ignore my last post - I have managed to sort it!

    Thanks,

    Chris

+ 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