Excel中的排列 [英] Permutations in Excel
问题描述
如果您不用手动输入数字就能获得更快的完成方式,请帮忙。
谢谢!
在这个页面。将其复制到VBA模块中,然后在Excel中创建一列0到n的整数,其中n =您想要的ID数。在下一列中,使用第一列的值作为第一个参数调用VBA函数,将第三个参数作为第二个参数。一些像
列A列b
0 = baseconv(A1,3)
1 = baseconv A2,3)
2 = baseconv(A3,3)
...等
您的ID实际上只是使用基数3计数系统的增量值。您可以格式化输出以获得自定义格式为000000的前导零。
顺便提一下,使用6个位置和3个可用值,您可以获得3 ^ 6,或729唯一ID
I am have a string with 6 spaces, e.g. 000000. Each space can hold one of three digits - 0, 1, or 2. I know that I can get a total of 120 permutations using the Permut function in Excel, i.e. =PERMUT(6,3) = 120. But I would actually like to have each individual permutation in a cell, e.g. 000001, 000010, etc.. Ideally, the end result would be 120 rows of unique 6-digit IDs.
Please help if you know a faster way of accomplishing this without entering the figures manually.
Thanks!
There is a VBA functionin the last post on this page. Copy it into a VBA module, then in Excel, create a column of integers from 0 to n where n = the number of IDs you want. In the next column, call the VBA function with the value from the first column as the first argument, and 3 as the second argument. Something like
Column A Column b
0 =baseconv(A1, 3)
1 =baseconv(A2, 3)
2 =baseconv(A3, 3)
... etc.
Your IDs are really just incremental values using a base 3 counting system. You can format the output to get leading zeros with a custom format of '000000'.
Incidentally, with 6 positions and 3 available values, you can get 3 ^ 6, or 729 unique IDs
这篇关于Excel中的排列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!