+ Reply to Thread
Results 1 to 2 of 2

Matching numbers from a range (repost as I've confused myself)

  1. #1
    Forum Contributor
    Join Date
    02-08-2006
    Location
    UK
    MS-Off Ver
    2013
    Posts
    204

    Red face Matching numbers from a range (repost as I've confused myself)

    I've posted on this before but I've got a bit muddled so have posted again. I've attached the spreadsheet I have and the code I have so far is below.

    There is a range of numbers (A1:A32 (named "items"). B1 is a user entered number.
    The program is supposed to match the value in B1 using the numbers available in A1:A32, but only 1, 2 or 3 items can be used, and the same item cannot be used more than once.

    The fewest amount of items also need to be used to either get an exact match or a match within 10% of the target value. If this is not possible, then another item needs to be used and the same process repeated (There a better explanation underneath the code).

    Here's the code I have so far which I know matches one number exactly or within 10%, and if duplicate values (such as 200 and 200) matches exactly, but I can't for the life of me take it further. There is more code in the sheet, but I'm still trying to figure out exactly what it's doing (the disorder is so I can try to understand it!).

    Please Login or Register  to view this content.
    Conditions to go through in order:
    1. Find and use 1 number from A1:A32 that exactly matches the target (B1)
    2. Find and use 1 number from A1:A32 that comes within 10% of the target
    3. Find and use 2 numbers from A1:A32 that exactly matches the target
    4. Find and use 2 numbers from A1:A32 that come within 10% of the target
    5. Find and use 3 numbers from A1:A32 that exactly matches the target
    6. Find and use 3 numbers from A1:A32 that come within 10% of the target
    In any case, the same cell reference cannot be used more than once (so you cannot use the number 1 twice).
    Attached Files Attached Files
    Last edited by wonderdunder; 03-12-2011 at 05:33 AM.

  2. #2
    Forum Contributor
    Join Date
    02-08-2006
    Location
    UK
    MS-Off Ver
    2013
    Posts
    204

    Re: Matching numbers from a range (repost as I've confused myself)

    Think I've solved the problem.
    Last edited by wonderdunder; 03-12-2011 at 05:33 AM.

+ 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