Algunas veces quizás tengas que generar automáticamente diferentes contraseñas aleatorias. Esta podría ser una tarea muy simple si existiera una función de Excel tal como “RandomPassword”, así podrías escribir:
=RandomPassword(8)
Y obtener algo así como:
e8NwB9Bi
Bueno, esa es exáctamente la idea del Add-in (complemento) que hice…

Si no es esto lo que estás buscando, como alternativa, podés visitar el generador online de contraseñas aleatorias.
La sintáxis de la función es:
=RandomPassword(length, [uppercase = TRUE], [numbers = TRUE], [lowercase = TRUE])
Así de simple… Acá están los links de descarga:
Si no sabés cómo podrías instalar un Add-in (complemento) de Excel, pronto voy a escribir un post al respecto, así que mantenete atento a las actualizaciones del sitio… Por ahora, te puedo dar los siguientes pasos:
1- Copiar la version correspondiente del add-in (XLA o XLAM) a C:\Archivos de Programa\Microsoft Office\OfficeXX\Library (donde XX es la versión de Office, siendo 12 para Office 2007)
2- Seguir las instrucciones dadas acá para Office 2003 or anterior, o ver los pasos de la primera parte de esta página para Office 2007.
El código está liberado bajo la licencia GNU GPL v3…
En el caso de que quieras ver el código de la función sin tener que mirar dentro del add-in:
Function RandomPassword(Length As Integer, Optional Upper As Boolean = True, Optional Number As Boolean = True, Optional Lower As Boolean = True)
If Not Upper And Not Lower And Not Number Then
RandomPassword = "";
Exit Function
End If
Dim Ret As String
Dim Num As Integer
Dim Repeat As Boolean
Randomize
Chars = 26 * 2 + 10 '26 (a-z) + 26 (A-Z) + 10 (0-9)
'a-z = 97-122
'A-Z = 65-90
'0-9 = 48-57
For i = 1 To Length
Repeat = False
Num = Int(Chars * Rnd) 'Int((upperbound - lowerbound + 1) * Rnd + lowerbound)
If Num < 26 Then 'a-z
If Lower Then
Ret = Ret & Chr(Num + 97)
Else
Repeat = True
End If
ElseIf Num < 52 Then 'A-Z
If Upper Then
Ret = Ret & Chr(Num - 26 + 65)
Else
Repeat = True
End If
ElseIf Num < 62 Then '0-9
If Number Then
Ret = Ret & Chr(Num - 52 + 48)
Else
Repeat = True
End If
End If
If Repeat Then
i = i - 1
End If
Next i
RandomPassword = Ret
End Function
Tu ayuda es valorada!
Todo el contenido ofrecido en este sitio, a menos que se indique lo contrario, es de naturaleza libre. Esto significa que podés compartirlo siempre y cuando lo hagas en forma gratuita y aclarando la fuente.
Si te resultó útil y querés contribuir, podés hacer una donación o, al menos, visitar alguno de nuestros patrocinadores de tu elección; están por todo el sitio.
Incoming search terms for the article:
- excel password generator
- random password generator excel
- excel random password generator
- password generator excel
- excel random password
- excel random string
- random password excel
- excel generate random password
- excel generate password
- excel password generator formula
Related posts:
Thanks a lot for ur work, i think it will help me,
You’re welcome!
Greetings!
This is such a great tool. Is there a way you can add special Characters to the add in? e.g. * @ ^
I’ll do it in a while…
Subscribe to the feed so you can get notified…
Greetings!
Fantastic function. I have been racking my brains trying to get this to work.
I’m glad it helped!!
Thanks for your comment!
Greetings!
Great – it works. I would like to ask if this is possible to edit content of xlam file – I would like to get some additional knowledge.
I would like to ask if it possible to call such ADD-on from macro (how – using Excel_function or how is called this function)?
I would like to write macro which will fill all cell in selected range (for each cell in range) typing there generated password.
Anyway to add symbols like ! @ # $ % ^ & *
I’ll donate more if possible. Thank you.
Wonderful tool, just what I am looking for … for Office 2010! Any suggestions? It goes fine until I have to add the ‘button’ to the ribbon.
thanks a lot for your work. I’ve been using this tool for a while. Since I am going to move Office 2010, I wonder if it works with Excel 2010. Your download links are only for 2003 and 2007.
Thanks
What would be a little nicer for the user is checkboxes for the options, so it’s not necessary to type “true” or “false” into all of those cells.
Actually it might be even more slick to put it all into a UserForm.
am very great for the code , it really work for me and am happy
Awesome, I was looking for something like this and found it…Thank you.
It duplicate password…try that on a column and than order alpha..(excel 2007)