Results 1 to 7 of 7

udf to pull distinct values from independent columns in excel

Threaded View

  1. #1
    Registered User
    Join Date
    02-20-2023
    Location
    rome
    MS-Off Ver
    office 2021
    Posts
    15

    udf to pull distinct values from independent columns in excel

    Hello everybody. I need some help to write an udf in excel VBA that could pull a number from each of several columns (with elements in common) so that all pulled numbers are different. Let's say that the starting columns were A:[1,3,6], B:[2,4,5,6], C:[2,3,7], D:[1]. One possible solution could be [3,4,7,1]. The function has to consider dependancies between columns, in fact, in this case the number 1 can't be pulled from column A or else it won't be possible to pull anything from column D.
    to work around the problem i'm using a formula that calculates all possible combinations between columns and then filters for distinct values only. Then, i take a random solution using ARRAY and RANDBETWEEN formulas. this process, however, contains two big flaws:

    1-Once the number of combinations exceeds the row limit number (1048576), the formula returns an error.
    2-The formula calculates all possible solutions so it becomes increasingly slower as i add new columns.
    I'm looking for an udf using excel VBA that gets rid of these problems.

    In this worksheet i provide some examples to better understand the problem
    EXAMPLES.xlsm

    i already posted this question on reddit, but no one answered me yet. i would link the thread but the website is not letting me
    Attached Files Attached Files
    Last edited by MrBlonde_; 04-23-2023 at 01:52 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Two columns unique distinct values to listbox
    By diegoasm11 in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 03-24-2021, 05:33 AM
  2. [SOLVED] Count distinct values in two columns where the third matches a value
    By LLTom2021 in forum Excel Formulas & Functions
    Replies: 19
    Last Post: 02-20-2021, 07:54 AM
  3. Counting distinct values across columns
    By winkywright in forum Excel General
    Replies: 5
    Last Post: 12-09-2020, 09:35 AM
  4. Formula to compare two tables and pull distinct text values
    By markedwards in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-01-2020, 06:10 PM
  5. Pulling together distinct values from several columns
    By Asif75 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-11-2013, 12:09 PM
  6. Replies: 0
    Last Post: 08-03-2012, 04:31 PM
  7. count two columns for distinct values
    By warrencameron in forum Excel - New Users/Basics
    Replies: 4
    Last Post: 07-18-2011, 09:09 AM

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