+ Reply to Thread
Results 1 to 25 of 25

Wrong SUM value on a profit calc.

  1. #1
    Registered User
    Join Date
    03-15-2014
    Location
    portugal
    MS-Off Ver
    Excel 2003
    Posts
    61

    Wrong SUM value on a profit calc.

    Somehow this formula it's not working and i can't figure out why.


    =B4-I4-J4-(SUMIFS([Inventory2014.xlsx]Inventory!F:F;[Inventory2014.xlsx]Inventory!A:A;$A4))


    B4 it's 10€
    I4 it's 0,71€
    J4 it's 0,44€

    and A4 on SUMIF it's 2,39€.

    Shows me a result 8,85€, somehow it's not subtracting A4.

    Am i doing something wrong here?

  2. #2
    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: Wrong SUM value on a profit calc.

    Note that the sumifS() function needs the sum-range as the 1st argument, it loks like column A is that range?

    The sumif() rakes the criteria range argument 1st, so either swap to sumif() or change the ranges in sumifS() - you only really need to use sumifS() if you have more than 1 criteria...
    sum the income from all red shoes sold to women on sunday's
    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

  3. #3
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Wrong SUM value on a profit calc.

    A4 is on the same sheet that B4, I4, and J4 are, not Inventory. Maybe you want

    =B4-I4-J4-SUMIFS([Inventory2014.xlsx]Inventory!F:F; [Inventory2014.xlsx]Inventory!A:A; [Inventory2014.xlsx]Inventory!$A4)
    Entia non sunt multiplicanda sine necessitate

  4. #4
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Wrong SUM value on a profit calc.

    Hi,

    We really need to see the workbook to comment. But does column F in the Inventory2014 workbook on the Inventory sheet total 2.39 where column A on that same workbook is the same as A4 on your CURRENT workbbok? Did you perhaps mean that to be


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

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  5. #5
    Registered User
    Join Date
    03-15-2014
    Location
    portugal
    MS-Off Ver
    Excel 2003
    Posts
    61

    Re: Wrong SUM value on a profit calc.

    First of all, thank you guys for help, really appreciate it!

    I tried both formulas posted above and the result it's still the same so i'll post the workbooks here.




    Sales2014.xlsxInventory2014.xlsx

  6. #6
    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: Wrong SUM value on a profit calc.

    You have a trailing space atthe end of R01 in Sales April sheet.

    It also doesnt like the "" in I and J...it doesnt like a negative "", maybe change that to 0 instead of ""?

  7. #7
    Registered User
    Join Date
    03-15-2014
    Location
    portugal
    MS-Off Ver
    Excel 2003
    Posts
    61

    Re: Wrong SUM value on a profit calc.

    Quote Originally Posted by FDibbins View Post
    You have a trailing space atthe end of R01 in Sales April sheet.

    It also doesnt like the "" in I and J...it doesnt like a negative "", maybe change that to 0 instead of ""?

    I need that trailing space because i'll import a sales file from the website with the item code before item designation. It will come like this: "R01 Brand New Bike..."


    I changed to 0 and cells now show "- €"

  8. #8
    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: Wrong SUM value on a profit calc.

    If you need it on 1 side, add it on the other side as well. As far as excel is concerned, "RO1" is not the same as "RO1 "
    Perhaps change the last part to...
    LEFT($A4,3) instead of just $A4

  9. #9
    Registered User
    Join Date
    03-15-2014
    Location
    portugal
    MS-Off Ver
    Excel 2003
    Posts
    61

    Re: Wrong SUM value on a profit calc.

    I did those changes but now i have "- €" on I4 and J4.

  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: Wrong SUM value on a profit calc.

    I am out of time right now, I should be able to take another look at this in a few hours

  11. #11
    Registered User
    Join Date
    03-15-2014
    Location
    portugal
    MS-Off Ver
    Excel 2003
    Posts
    61

    Re: Wrong SUM value on a profit calc.

    Ok, thank you.

  12. #12
    Registered User
    Join Date
    03-15-2014
    Location
    portugal
    MS-Off Ver
    Excel 2003
    Posts
    61

    Re: Wrong SUM value on a profit calc.

    Maybe someone else can help me please!

  13. #13
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Wrong SUM value on a profit calc.

    Hi,

    1. Remove the trailing space from A4 on inventory
    2.As a consequence of 1, simplify I4
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    changing the final "", to a zero
    3. Change the final "" in J4 to a zero too
    4. K4:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  14. #14
    Registered User
    Join Date
    03-15-2014
    Location
    portugal
    MS-Off Ver
    Excel 2003
    Posts
    61

    Re: Wrong SUM value on a profit calc.

    Hi Richard.

    I need that trailer space to count stock sold because i import a sales csv from the website and Sales!A4 comes like this: "R01 Mountain Bike"

    Always code first then space and then item description.


    Is there some other way to fix this without remove that trailer?

  15. #15
    Registered User
    Join Date
    03-15-2014
    Location
    portugal
    MS-Off Ver
    Excel 2003
    Posts
    61

    Re: Wrong SUM value on a profit calc.

    Can i use(and how) the same trailing space on K4?

    =B4-I4-J4-(SUMIFS([Inventory2014.xlsx]Inventory!F:F;[Inventory2014.xlsx]Inventory!A:A;$A4))

  16. #16
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Wrong SUM value on a profit calc.

    Hi,

    It works for me if you use the TRIM() function in the formula. i.e.

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


    As a general point when importing data you can define the split points in text fields at the time of import so that you don't have redundant spaces in data. That's a tidier solution than having to work around with a TRIM() or any other functions.

  17. #17
    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: Wrong SUM value on a profit calc.

    OK how about something like this?
    =IF(B5="","",B5-I5-J5-(SUMIFS([Inventory2014.xlsx]Inventory!F:F,[Inventory2014.xlsx]Inventory!A:A,$A5)))

    This is based on, if B is empty, I and J will also be empty, so you wont need a value in K

    edit: this may work better...
    =IF(B5="","",B5-IF(I5="",0,I5)-IF(J5="",0,J5)-(SUMIFS([Inventory2014.xlsx]Inventory!F:F,[Inventory2014.xlsx]Inventory!A:A,$A5)))

    Also, you dont need to ARRAY enter formulas liks...
    ={SUMIF(Orders!C:C,A7,Orders!D:D)-(H7)}, you just need...
    =SUMIF(Orders!C:C,A7,Orders!D:D)-H7
    Last edited by FDibbins; 04-04-2014 at 03:57 PM.

  18. #18
    Registered User
    Join Date
    03-15-2014
    Location
    portugal
    MS-Off Ver
    Excel 2003
    Posts
    61

    Re: Wrong SUM value on a profit calc.

    Quote Originally Posted by Richard Buttrey View Post
    Hi,

    It works for me if you use the TRIM() function in the formula. i.e.

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





    As a general point when importing data you can define the split points in text fields at the time of import so that you don't have redundant spaces in data. That's a tidier solution than having to work around with a TRIM() or any other functions.

    Richard you are like God!

    You saved my *** here :D

    Thank you soooo much!

  19. #19
    Registered User
    Join Date
    03-15-2014
    Location
    portugal
    MS-Off Ver
    Excel 2003
    Posts
    61

    Re: Wrong SUM value on a profit calc.

    Quote Originally Posted by FDibbins View Post
    OK how about something like this?
    =IF(B5="","",B5-I5-J5-(SUMIFS([Inventory2014.xlsx]Inventory!F:F,[Inventory2014.xlsx]Inventory!A:A,$A5)))

    This is based on, if B is empty, I and J will also be empty, so you wont need a value in K

    edit: this may work better...
    =IF(B5="","",B5-IF(I5="",0,I5)-IF(J5="",0,J5)-(SUMIFS([Inventory2014.xlsx]Inventory!F:F,[Inventory2014.xlsx]Inventory!A:A,$A5)))

    Also, you dont need to ARRAY enter formulas liks...
    ={SUMIF(Orders!C:C,A7,Orders!D:D)-(H7)}, you just need...
    =SUMIF(Orders!C:C,A7,Orders!D:D)-H7

    Thank you for help but i solved it with Richard trim function.

  20. #20
    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: Wrong SUM value on a profit calc.

    Im just glad you got it resolved

    Did you read my last comment in post # 18?
    Thanks for the feedback

  21. #21
    Registered User
    Join Date
    03-15-2014
    Location
    portugal
    MS-Off Ver
    Excel 2003
    Posts
    61

    Re: Wrong SUM value on a profit calc.

    Unfortunately Richard's tip didn't work as well :'(

    FDibbins i tried your formulas and they are also with the same problem: works when there's just the code and space (R01 ) but doesn't work when i have code, space, item description(R01 mountain bike) and i reeeeeally need it to work with code, space, item description.

    Please take a look at this workbooks to see what i'm talking about:



    Sales2014.xlsxInventory2014.xlsx

  22. #22
    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: Wrong SUM value on a profit calc.

    I cannot see what you need the trailing space. If you are extracting the RO1 from something for use elsewhere, then extracting it without the training space will give you pretty much the same as extracting it with the trailing space. Keep your data in teh same format and the problem will go away - either have the the trailing space both side, or dont haqve it either side

  23. #23
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Wrong SUM value on a profit calc.

    Quote Originally Posted by Luther.King View Post
    Unfortunately Richard's tip didn't work as well :'(


    Attachment 309661Attachment 309662
    The reason is you've introduced another variable in the form of the Item Ref R01 now having a description attached. viz. R01 mountain bike. When you are comparing values in one workbook with another you need to compare EXACTLY the same values.

    You'll need to change the formula in K4 on Saleas 2014 April sheet to

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

  24. #24
    Registered User
    Join Date
    03-15-2014
    Location
    portugal
    MS-Off Ver
    Excel 2003
    Posts
    61

    Re: Wrong SUM value on a profit calc.

    Hi.

    Works but not very well.

    It's assuming R01 very well but when i enter the item code R011 or R012 or R012011 he also assumes the values of R01 and doesn't calculates R012 values.

    Please take a look at the workbook with those examples:

    Inventory2014.xlsxSales2014.xlsx

  25. #25
    Registered User
    Join Date
    03-15-2014
    Location
    portugal
    MS-Off Ver
    Excel 2003
    Posts
    61

    Re: Wrong SUM value on a profit calc.

    Ok, no finally worked!!!!

    =B4-I4-J4-(SUMIFS([Inventory2014.xlsx]Inventory!G:G;[Inventory2014.xlsx]Inventory!A:A;(LEFT(A4;FIND(" ";A4)-1))))



    Thank's for help anyway.
    Last edited by Luther.King; 04-05-2014 at 08:50 PM.

+ 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: 02-24-2014, 01:46 PM
  2. Replies: 0
    Last Post: 01-21-2014, 12:04 PM
  3. How do I set some wksht formulas to calc. manually and others to calc. automatically?
    By hoboking87 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-26-2013, 08:16 PM
  4. 1. consecutive days of profit and of losses 2. biggest profit loss since date
    By xbohemianx in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 05-14-2013, 12:57 PM
  5. [SOLVED] auto calc on, but have to edit (f2) cells to force re-calc..help!
    By Curt in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-13-2006, 02:10 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