Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 08-08-2025, 04:39 AM
yeevee yeevee is offline variations by using 5 of 6 different values Windows 8 variations by using 5 of 6 different values Office 2010
Novice
variations by using 5 of 6 different values
 
Join Date: Aug 2025
Posts: 2
yeevee is on a distinguished road
Default variations by using 5 of 6 different values

Hello,
I hope someone can help me with this.
I have 6 letters (later to be used for a yarn crochet project), but I will only use 5 at the time. Then I use another 5, and another 5 and so on.
I want them all to be unique.
Maybe a routine for the letter A will be enough. I ones followed a Macro and VBA training, and I still can read the most of it, but I miss the skills to really programming.

Thanks very much for helping me

So I have ABCDEF. I made a little beginning on paper, don't think I can finish this that way :-)
Starting with A, is looks like this:
ABCDE
ABCDF
ABCED (note: these are the same as I started with, but they are in a different order)
ABCEF
ABCFD
ABCFE


ABDCE
ABDEF
ABDEC
ABDEF
ABDFC
ABDFE
And so on, and so on.
Reply With Quote
  #2  
Old 08-08-2025, 12:08 PM
p45cal's Avatar
p45cal p45cal is offline variations by using 5 of 6 different values Windows 10 variations by using 5 of 6 different values Office 2021
Expert
 
Join Date: Apr 2014
Posts: 956
p45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond repute
Default

This is specific for 5 chosen out of 6 possibles:
Code:
Sub blah()
x = "ABCDEF"
y = Len(x)
Count = Application.WorksheetFunction.Permut(y, 5)
Set Destn = ActiveCell
ReDim Results(1 To Count, 1 To 1)
idx = 0
ReDim result(1 To 5)
For a = 1 To y
  result(1) = Mid(x, a, 1)
  For b = 1 To y
    If b <> a Then
      result(2) = Mid(x, b, 1)
      For c = 1 To y
        If c <> a And c <> b Then
          result(3) = Mid(x, c, 1)
          For d = 1 To y
            If d <> a And d <> b And d <> c Then
              result(4) = Mid(x, d, 1)
              For e = 1 To y
                If e <> a And e <> b And e <> c And e <> d Then
                  result(5) = Mid(x, e, 1)
                  idx = idx + 1
                  Results(idx, 1) = Join(result, "")
                End If
              Next e
            End If
          Next d
        End If
      Next c
    End If
  Next b
Next a
Destn.Resize(idx) = Results
End Sub
It's clunky but it should run fast. Results are output to the active cell and the 719 cells below it.
Reply With Quote
  #3  
Old 08-08-2025, 12:35 PM
yeevee yeevee is offline variations by using 5 of 6 different values Windows 8 variations by using 5 of 6 different values Office 2010
Novice
variations by using 5 of 6 different values
 
Join Date: Aug 2025
Posts: 2
yeevee is on a distinguished road
Default

thank, thank, thank you so very much!!!!!
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Need to match values in one column to values in six others and return the value of a cell from corre SnakeDoctor Excel 4 09-09-2024 12:55 PM
variations by using 5 of 6 different values VBA to identify alpha numeric values in a word document and create a list of those values olson.jacob720 Word VBA 0 04-18-2022 10:44 AM
Table with values from several locations and years - need to find comp values Ricardo Sousa Excel 9 07-27-2018 02:06 AM
variations by using 5 of 6 different values Table with values from several locations and years - need to find comp values Ricardo Sousa Excel 6 06-09-2018 10:51 PM
finding variations in the data base adryan Excel 4 07-15-2015 12:19 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:04 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft