+ Reply to Thread
Results 1 to 24 of 24

Customized sum

  1. #1
    Forum Contributor
    Join Date
    12-23-2012
    Location
    Pakistan
    MS-Off Ver
    Excel 2016
    Posts
    358

    Customized sum

    Please find the attachment for a question mention in the workbook.
    Attached Files Attached Files

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,460

    Re: Customized sum

    Sorry for off-topic interjection:

    Although there is no official rule regarding this behaviour, we request that wherever possible both the question AND the answer be provided in substantive detail here within the thread. An attached workbook is an excellent aid for posing a question and offering a solution, but solely doing that with no in thread explanation makes it difficult for researchers to understand or consider the Q & A of this thread without downloading what may be a pointless doc to them, if they can do that at all. Doing that also hides the content from search engines so others may never benefit from this.
    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.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,460

    Re: Customized sum

    How do you arrive at this result?

    In D1: 4556.92

  4. #4
    Forum Contributor
    Join Date
    12-23-2012
    Location
    Pakistan
    MS-Off Ver
    Excel 2016
    Posts
    358

    Re: Customized sum

    someone said to me, I know whatever you said but actually i need the sum of that amount with the formula
    suppose these are my outstanding amount and someone pay the 4556.92, then I want to see which invoices amount the concerned paid
    Last edited by geniusufo007; 11-03-2018 at 06:24 AM.

  5. #5
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,460

    Re: Customized sum

    What do you mean? Do you seriously believe that the sum of A2 to A55 is 4556.92? It isn't - it's over 35000!!!

    Type this into D1:

    =SUM(A2:A55)

    So, let's start again: what EXACTLY are you trying to do here?

  6. #6
    Forum Contributor
    Join Date
    12-23-2012
    Location
    Pakistan
    MS-Off Ver
    Excel 2016
    Posts
    358

    Re: Customized sum

    someone ask me
    Attached Images Attached Images

  7. #7
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,460

    Re: Customized sum

    So you have said twice now. Doesn't matter - unless I know how 'someone' has arrived at that number, I can't help you.

    Look:

    Excel 2016 (Windows) 32 bit
    A
    B
    C
    D
    1
    35,994.20
    2
    77.74
    3
    83.06
    4
    89.40
    5
    116.14
    6
    126.69
    7
    144.77
    8
    160.62
    9
    185.58
    10
    192.65
    11
    194.58
    12
    219.10
    13
    222.52
    Sheet: Sheet4
    Last edited by AliGW; 11-03-2018 at 06:24 AM.

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

    Re: Customized sum

    Quote Originally Posted by geniusufo007 View Post
    someone said to me, I know whatever you said but actually i need the sum of that amount with the formula
    suppose these are my outstanding amount and someone pay the 4556.92, then I want to see which invoices amount the concerned paid
    Do NOT edit posts that have received replies - your edits will mostly go unnoticed.

    Which values in your list do you think make up that amount? Is this homework?

  9. #9
    Forum Contributor
    Join Date
    12-23-2012
    Location
    Pakistan
    MS-Off Ver
    Excel 2016
    Posts
    358

    Re: Customized sum

    The amount shown in the sheet shown by you is the total amount but the person paid out the this amount, which is 4556.92, now if i want to check which amount is equal to 4556.92, so is there any formula which sum of the above figure

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

    Re: Customized sum

    I give up - you just don't answer my questions.

    Good luck with this.

  11. #11
    Forum Contributor
    Join Date
    12-23-2012
    Location
    Pakistan
    MS-Off Ver
    Excel 2016
    Posts
    358

    Re: Customized sum

    Thanks for your follow up, just leave it

  12. #12
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: Customized sum

    Just play along

    =SUM(A2:A55)-SUM(A2:A55)+D1

  13. #13
    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,496

    Re: Customized sum

    my guess is that the OP wants to know which items in column A between A2 and A55 would be added together to get 4556.92.
    Make contributors happy, click on the "* Add Reputation" as a way to say thank you.
    Sam Capricci

  14. #14
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,460

    Re: Customized sum

    Yes, and I asked about just that in post #8 - the question was ignored. My guess is that the OP has been given this to work out - it's probably a homework task. I asked that, too - guess what? No response.

  15. #15
    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: Customized sum

    I have some code running to test that. So far, it's found 642 combinations that total 4556.92, with 0.4% of the combinations tested.

    Now 809. There's an average of over 5,000,000 solutions to any possible result. I can explain why, but it's a little math-y.

    Now 1,186.

    1370 ... 1508 ... 2304 ... 2543 at 1% complete ...
    Entia non sunt multiplicanda sine necessitate

  16. #16
    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,496

    Re: Customized sum

    I wondered if it could be done by a formula, I think it is an interesting problem and have been trying to contemplate how the formula would look.
    Now, based on shg's comment I see it is likely a code based solution.

  17. #17
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,814

    Re: Customized sum

    This looks like a subset sum problem (https://en.wikipedia.org/wiki/Subset_sum_problem ). As shg's post notes, it is usually solved by some variation of "try every possible combination and identify which one(s) add up to the resulting sum. The main difficulty is that there are a lot (millions or billions or trillions or more, depending on the specific problem) of possible combinations to try, so that the computational effort needed to find all possible solutions and try them is often huge.

    Most "first attempt" excel solutions to the subset sum problem try using Solver: https://www.get-digital-help.com/201...lver-in-excel/
    Most rigorous attempts will use VBA to generate all possible combinations -- something like this http://www.tushar-mehta.com/excel/te...e_combinations

    Conceptually, the subset sum problem seems simple, but, as an NP-complete type problem, it is surprisingly difficult to program a rigorous solution into a computer.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  18. #18
    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: Customized sum

    19,085 at 4.7% complete

  19. #19
    Forum Contributor
    Join Date
    10-08-2018
    Location
    Lima, Peru
    MS-Off Ver
    Office 365 ProPlus
    Posts
    148

    Re: Customized sum

    There is no "genius" formula to get what OP wants, it has to be a brute force sequence of sums until a valid combination of cells is found, there is no guarantee that a solution can be found, or that there is a unique solution.

    Solver can try to find a solution:
    Fill range C with range A times range B
    In D2, sum range C, it's 0, as range B is empty
    Solver
    Objective: D2 value of 4556.92
    By changing Variable Cells: $B$2:$B$55
    Subject to the constrains: $B$2:$B$55 is binary

    Click SOLVER button, sit and wait... it's over 50 variables combinations.

  20. #20
    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: Customized sum

    That gives one solution; what about the others?

    30,319 at 6.5% complete.

  21. #21
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: Customized sum

    I wonder if Tushar Mehta's "VBA code to find multiple matching combinations" could find the total number of combinations?

    http://www.tushar-mehta.com/excel/te...ues/index.html

    Myself I'll relax with a small glass of whiskey and Robert Kanigel's book "The man who knew infinity" where even if I don't understand the math described I will hopefully understand most of the words.

    Alf

  22. #22
    Forum Contributor
    Join Date
    12-23-2012
    Location
    Pakistan
    MS-Off Ver
    Excel 2016
    Posts
    358

    Re: Customized sum

    Thanks Mr Shorty for your attempt
    Attached Files Attached Files
    Last edited by geniusufo007; 11-04-2018 at 07:31 AM.

  23. #23
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,460

    Re: Customized sum

    This has been marked as solved - can you please confirm that it is?

  24. #24
    Forum Contributor
    Join Date
    12-23-2012
    Location
    Pakistan
    MS-Off Ver
    Excel 2016
    Posts
    358

    Re: Customized sum

    yes a nice solution

+ 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. [SOLVED] Customized sorting
    By Immortal2014 in forum Excel General
    Replies: 23
    Last Post: 08-19-2017, 04:18 PM
  2. Customized sorting
    By Immortal2014 in forum Excel General
    Replies: 1
    Last Post: 08-19-2017, 08:26 AM
  3. Customized from Template
    By seanmic in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-15-2017, 03:36 PM
  4. [SOLVED] Customized sum
    By kk_usa in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 02-26-2014, 03:25 AM
  5. Customized formating
    By Domyzon in forum Excel General
    Replies: 3
    Last Post: 10-28-2011, 09:22 AM
  6. Customized toolbars
    By bgn2 in forum Excel General
    Replies: 0
    Last Post: 05-14-2008, 11:50 AM
  7. [SOLVED] Customized components
    By Souris in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-18-2005, 07:05 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