+ Reply to Thread
Results 1 to 9 of 9

combination of numbers that equals "X"

  1. #1
    Registered User
    Join Date
    10-31-2018
    Location
    İstanbul Turkey
    MS-Off Ver
    2013
    Posts
    5

    combination of numbers that equals "X"

    Hello Everyone,

    I need some help.

    The attached excel calculates combinations which goes to target with entered values sums.. Tolerance in excel works both - and + ways. How can i modify macro to tolerance works only + way.

    Thank you in advance.
    Attached Files Attached Files
    Last edited by ufukayyıldız; 11-01-2018 at 03:57 PM.

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: combination of numbers that equals "X"

    I think that you need to modify this line.

    If Abs(t - y) < TOL Then


    Try

    If t - y < TOL and t - y >= 0 Then

    or

    If y - t < TOL and y - t >= 0 Then

    One of them should work.
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

  3. #3
    Registered User
    Join Date
    10-31-2018
    Location
    İstanbul Turkey
    MS-Off Ver
    2013
    Posts
    5

    Re: combination of numbers that equals "X"

    Quote Originally Posted by mehmetcik View Post
    I think that you need to modify this line.

    If Abs(t - y) < TOL Then


    Try

    If t - y < TOL and t - y >= 0 Then

    or

    If y - t < TOL and y - t >= 0 Then

    One of them should work.

    Thank you so much . I tried but did not work.
    Last edited by ufukayyıldız; 11-01-2018 at 06:27 AM.

  4. #4
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: combination of numbers that equals "X"

    Please give a sample of an input and an expected output.

  5. #5
    Registered User
    Join Date
    10-31-2018
    Location
    İstanbul Turkey
    MS-Off Ver
    2013
    Posts
    5

    Re: combination of numbers that equals "X"

    Hi mehmetcik,

    I entered some numbers in C column in Input page and excel calculated combinations of these numbers sums equals to target, target - tolerance and target + tolerance.
    But i want only calculate only combinations of these numbers sums equals to target and target + tolerance . Not target - tolerance
    Also I attached excel file and 2 images to explain my target.

    Thank you again.
    Attached Images Attached Images
    Attached Files Attached Files
    Last edited by ufukayyıldız; 11-01-2018 at 03:38 PM.

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

    Re: combination of numbers that equals "X"

    Cut the tolerance in half, then change the target to target + tolerance.
    Entia non sunt multiplicanda sine necessitate

  7. #7
    Registered User
    Join Date
    10-31-2018
    Location
    İstanbul Turkey
    MS-Off Ver
    2013
    Posts
    5

    Re: combination of numbers that equals "X"

    Thanks shg,

    I am sorry i am new, How can i do this, can you explain on code please ?

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

    Re: combination of numbers that equals "X"

    I haven't looked at the workbook.

    Let's say the target is $100 and the tolerance is $10 -- that finds totals between $90 and $110, which you don't want.

    So change the tolerance to $5 and the target to $105; that finds totals between ____? and ____?

  9. #9
    Registered User
    Join Date
    10-31-2018
    Location
    İstanbul Turkey
    MS-Off Ver
    2013
    Posts
    5

    Re: combination of numbers that equals "X"

    Thanks, good idea. It works.

+ 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. Random numbers whose sums equals "x"
    By ceranes in forum Excel General
    Replies: 10
    Last Post: 01-19-2018, 02:03 PM
  2. [SOLVED] Day counts, formulas between colums. "c" minus "f" = equals ???.
    By israelalvarado in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-28-2017, 05:58 PM
  3. [SOLVED] If cell equals "CR" then make cell to left negative and delete "CR".......
    By pasqualebaldi in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 01-14-2016, 07:51 PM
  4. Check if A1 equals the sum of A2+A3 display "correct" if not "Try again"
    By eatmydust in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-23-2014, 09:14 AM
  5. [SOLVED] Delete row if cell in Column N equal "Different" or Column P equals "Blank"
    By Cyberpawz in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-17-2012, 08:25 AM
  6. Replies: 2
    Last Post: 05-17-2012, 03:12 AM
  7. Replies: 2
    Last Post: 01-26-2011, 06:45 AM

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