+ Reply to Thread
Results 1 to 12 of 12

Same Sum Formula Returns Different Results

  1. #1
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Question Same Sum Formula Returns Different Results

    Hi Guys,

    Please see the attached WorkBook.

    I find this very strange

    In Column E the Sum Formula returns the correct result, but using that same Formula it returns a wrong result in Column B. And I cannot figure out why this is so.

    What am I doing wrong?
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Same Sum Formula Returns Different Results

    b9=ak1

    e9=an1

    The formule in AK1 is 100% equal to the formula in AN1?
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  3. #3
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Same Sum Formula Returns Different Results

    Hi oeldere,

    Thank you for responding.

    b9=ak1

    e9=an1
    You mean
    b11=ak1

    e11=an1
    Your observation is correct. AK1 is 100% equal to the formula in AN1. Then why does B11 show 13 instead of 65 like it shows in E11?

  4. #4
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Same Sum Formula Returns Different Results

    You have mismatched brackets in the formula in AK1. The following returns 65 as the result.

    Please Login or Register  to view this content.

  5. #5
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Same Sum Formula Returns Different Results

    Thank you so much Cutter!

    I am so tired that I just cannot see the wood from the trees, so to speak. I have assumed that if it works in AN1, it should also do so in AK1. But you have spotted my mistake which I will have a look into when I feel "fresher".

    I also just had a gut feel that you were going to solve this one for me.

    Once again, Thank You.

  6. #6
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Same Sum Formula Returns Different Results

    You're welcome. Thanks for the 'star tap'.

    You know, you could simplify things:

    The first section MAY be simplified from:

    =IF(RIGHT(A15,2)="1S",B15,IF(RIGHT(A15,2)="2S",B15*2,IF(RIGHT(A15,3)="2SN",B15*2,IF(RIGHT(A15,3)="2SW",B15*2,IF(RIGHT(A15,2)="3S",B15*3,IF(RIGHT(A15,3)="3SN",B15*3))))))

    to:

    =MID(A15,11,1)*B15

    depending on the consistency of your data

    similar changes to the rest of the sections, if so
    Last edited by Cutter; 08-05-2012 at 09:21 AM. Reason: Added thanks

  7. #7
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Same Sum Formula Returns Different Results

    Hello Cutter,

    Thank you for the feedback. Unfortunately my Data is too inconsistent to use the MID function.

    Keep up the good work!

  8. #8
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Same Sum Formula Returns Different Results

    OK, how about the following which just finds the number preceding the "S" in the last 3 characters:

    =MID(RIGHT(A15,3),FIND("S",RIGHT(A15,3))-1,1)*B15

    to replace

    =IF(RIGHT(A15,2)="1S",B15,IF(RIGHT(A15,2)="2S",B15*2,IF(RIGHT(A15,3)="2SN",B15*2,IF(RIGHT(A15,3)="2SW",B15*2,IF(RIGHT(A15,2)="3S",B15*3,IF(RIGHT(A15,3)="3SN",B15*3))))))

  9. #9
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Same Sum Formula Returns Different Results

    Hello Cutter,

    Wow, I really like that. I never knew that one could use a combination of MID & RIGHT.

    I have tried it, but it returns a #VALUE# error if one of the lines is empty. Then I tried;

    Please Login or Register  to view this content.
    which also does not work.

    Thank you for all your time and efforts.

  10. #10
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Same Sum Formula Returns Different Results

    This alternative came to me while I was cutting the grass (don't ask, I don't know why):

    =LEFT(TRIM(RIGHT(A15,3)))*B15
    instead of
    =MID(RIGHT(A15,3),FIND("S",RIGHT(A15,3))-1,1)*B15

    On the formula in your last post you would get #VALUE error because you are adding text (the "" result is text). You can avoid that particular scenario by placing the components within a SUM(), which ignores text, OR replace the "" returns with 0.

    Try this:

    =IF(SUM(B15:B23)=0,"",
    IF(A15<>"",LEFT(TRIM(RIGHT(A15,3)))*B15,0)
    +IF(A17<>"",LEFT(TRIM(RIGHT(A17,3)))*B17,0)
    +IF(A19<>"",LEFT(TRIM(RIGHT(A19,3)))*B19,0)
    +IF(A21<>"",LEFT(TRIM(RIGHT(A21,3)))*B21,0)
    +IF(A23<>"",LEFT(TRIM(RIGHT(A23,3)))*B23,0))

    You could even do away with the opening IF() which would yield a 0 result instead of a "" result if that's acceptable.
    Last edited by Cutter; 08-06-2012 at 03:41 PM. Reason: Added explanation & alternative

  11. #11
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Same Sum Formula Returns Different Results

    Hello Cutter,

    Absolutely awesome!!! Brilliant and outstandingly perfect!

    Words fail me and, I cannot thank you enough for your valued persistence and contribution.

    It is working PERFECTLY, empty rows or not!

    I have also added a Gold Star next to your name on my wall of Fame.

    I also owe you a Coke and a Bun...LOL

  12. #12
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Same Sum Formula Returns Different Results

    Wow, that's got to the best thank you I've ever received. And a 'star tap' to go with it, too. Thanks.
    And I'll take you up on that Coke and a Bun.....if my sister ever convinces me to visit her in Jo'burg.

    Anyway, you're very welcome...glad I could help you get rid of that monster formula.

+ 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