excel怎么随机产生10位混合密码(含数字、字母)?

2024-12-26 19:46:06
推荐回答(5个)
回答1:

随机1位小写字母:=CHAR(INT(RAND()*26)+97)

随机1位大写字母:=CHAR(INT(RAND()*26)+65)

随机1位大小写混合字母:=CHAR(INT(RAND()*26)+if(INT(RAND()*2)=0,65,97))

产生随机的10位数的大小写混合字母和数字混合:

=CONCATENATE(IF(INT(RAND()*2)=0,CHAR(INT(RAND()*9+48)),IF(INT(RAND()*2)=0,CHAR(INT(RAND()*25+65)),CHAR(INT(RAND()*25+97)))),IF(INT(RAND()*2)=0,CHAR(INT(RAND()*9+48)),IF(INT(RAND()*2)=0,CHAR(INT(RAND()*25+65)),CHAR(INT(RAND()*25+97)))),IF(INT(RAND()*2)=0,CHAR(INT(RAND()*9+48)),IF(INT(RAND()*2)=0,CHAR(INT(RAND()*25+65)),CHAR(INT(RAND()*25+97)))),IF(INT(RAND()*2)=0,CHAR(INT(RAND()*9+48)),IF(INT(RAND()*2)=0,CHAR(INT(RAND()*25+65)),CHAR(INT(RAND()*25+97)))),IF(INT(RAND()*2)=0,CHAR(INT(RAND()*9+48)),IF(INT(RAND()*2)=0,CHAR(INT(RAND()*25+65)),CHAR(INT(RAND()*25+97)))),IF(INT(RAND()*2)=0,CHAR(INT(RAND()*9+48)),IF(INT(RAND()*2)=0,CHAR(INT(RAND()*25+65)),CHAR(INT(RAND()*25+97)))),IF(INT(RAND()*2)=0,CHAR(INT(RAND()*9+48)),IF(INT(RAND()*2)=0,CHAR(INT(RAND()*25+65)),CHAR(INT(RAND()*25+97)))),IF(INT(RAND()*2)=0,CHAR(INT(RAND()*9+48)),IF(INT(RAND()*2)=0,CHAR(INT(RAND()*25+65)),CHAR(INT(RAND()*25+97)))),IF(INT(RAND()*2)=0,CHAR(INT(RAND()*9+48)),IF(INT(RAND()*2)=0,CHAR(INT(RAND()*25+65)),CHAR(INT(RAND()*25+97)))),IF(INT(RAND()*2)=0,CHAR(INT(RAND()*9+48)),IF(INT(RAND()*2)=0,CHAR(INT(RAND()*25+65)),CHAR(INT(RAND()*25+97)))))

天呀!!!累死了!哪位高人还有其他简单的方法吗?

回答2:

LS都是高手啊,小弟借问下(RAND()*9+48,RAND()*25+65,RAND()*25+97),用哪个函数调出里面3个random中任意一个数值,用or就变成判断了,结果为TRUE

我的方法和几位相同,concatenate,char,但是会有大小英文和数字这3种结果,code码又不相连,所以要从上述3个条件中选一个

请教请教,麻烦告知不胜感激

折中实现大小写字母和数字混合的密码
=CONCATENATE(CHAR(INT(CHOOSE(INT(RAND()*2.999+1),RAND()*9+48,RAND()*25+65,RAND()*25+97))),CHAR(INT(CHOOSE(INT(RAND()*2.999+1),RAND()*9+48,RAND()*25+65,RAND()*25+97))),CHAR(INT(CHOOSE(INT(RAND()*2.999+1),RAND()*9+48,RAND()*25+65,RAND()*25+97))),CHAR(INT(CHOOSE(INT(RAND()*2.999+1),RAND()*9+48,RAND()*25+65,RAND()*25+97))),CHAR(INT(CHOOSE(INT(RAND()*2.999+1),RAND()*9+48,RAND()*25+65,RAND()*25+97))),CHAR(INT(CHOOSE(INT(RAND()*2.999+1),RAND()*9+48,RAND()*25+65,RAND()*25+97))),CHAR(INT(CHOOSE(INT(RAND()*2.999+1),RAND()*9+48,RAND()*25+65,RAND()*25+97))),CHAR(INT(CHOOSE(INT(RAND()*2.999+1),RAND()*9+48,RAND()*25+65,RAND()*25+97))),CHAR(INT(CHOOSE(INT(RAND()*2.999+1),RAND()*9+48,RAND()*25+65,RAND()*25+97))),CHAR(INT(CHOOSE(INT(RAND()*2.999+1),RAND()*9+48,RAND()*25+65,RAND()*25+97))))

回答3:

按ALT+F11组合键,调出VBA窗口,插入一个模块,把下面代码复制进去,执行即可得到10位随机数
Sub b()
Dim r As Integer
Dim n As String
Randomize
For i = 1 To 10 '随机数10位
r = Rnd() * 2
If r = 0 Then
t = Int(Rnd() * 9)
Else
t = Chr(Rnd() * (122 - 97) + 97)
End If
n = n & t
Next
MsgBox n
End Sub

回答4:

sheet2的A列里面做一列密码字符,包括0-9,a-z,A-Z(总共62个)

sheet1的A1到J1写公式
=INDEX(Sheet2!$A$1:$A$62,RANDBETWEEN(1,62))
K1是密码,写公式
=CONCATENATE(A1,B1,C1,D1,E1,F1,G1,H1,I1,J1)

回答5:

字母大小写不?给你个大写字母和数字的。
=CONCATENATE(IF(ROUND(RAND(),0),CHAR(RANDBETWEEN(48,57)),CHAR(RANDBETWEEN(65,90))),IF(ROUND(RAND(),0),CHAR(RANDBETWEEN(48,57)),CHAR(RANDBETWEEN(65,90))),IF(ROUND(RAND(),0),CHAR(RANDBETWEEN(48,57)),CHAR(RANDBETWEEN(65,90))),IF(ROUND(RAND(),0),CHAR(RANDBETWEEN(48,57)),CHAR(RANDBETWEEN(65,90))),IF(ROUND(RAND(),0),CHAR(RANDBETWEEN(48,57)),CHAR(RANDBETWEEN(65,90))),IF(ROUND(RAND(),0),CHAR(RANDBETWEEN(48,57)),CHAR(RANDBETWEEN(65,90))),IF(ROUND(RAND(),0),CHAR(RANDBETWEEN(48,57)),CHAR(RANDBETWEEN(65,90))),IF(ROUND(RAND(),0),CHAR(RANDBETWEEN(48,57)),CHAR(RANDBETWEEN(65,90))),IF(ROUND(RAND(),0),CHAR(RANDBETWEEN(48,57)),CHAR(RANDBETWEEN(65,90))),IF(ROUND(RAND(),0),CHAR(RANDBETWEEN(48,57)),CHAR(RANDBETWEEN(65,90))))