Formula RAND dan RANDBETWEEN yang dimiliki Microsoft Office Excel 2013 akan menghasilkan angka-angka secara acak. Namun untuk membuat String secara acak, formula ini perlu di pasangkan dengan formula CHAR.
=CHAR(RANDBETWEEN(65;90))&CHAR(RANDBETWEEN(65;90))&RANDBETWEEN(10;99)&"@"&CHAR(RANDBETWEEN(97;122))&CHAR(RANDBETWEEN(97;122))&CHAR(RANDBETWEEN(65;90))
Formula CHAR adalah formula yang menghasilkan karakter dari angka-angka ASCII.
Untuk menghasilkan 4 karakter string (capital) yang acak, dapat dihasilkan dari formula berikut.
=CHAR(RANDBETWEEN(65,90))& CHAR(RANDBETWEEN(65,90)) &
CHAR(RANDBETWEEN(65,90)) & CHAR(RANDBETWEEN(65,90))
CHAR(RANDBETWEEN(65,90)) & CHAR(RANDBETWEEN(65,90))
Untuk menghasilkan 4 karakter string (small) yang acak, dapat dihasilkan dari formula berikut.
=CHAR(RANDBETWEEN(97,122))& CHAR(RANDBETWEEN(97,122)) &
CHAR(RANDBETWEEN(97,122)) & CHAR(RANDBETWEEN(97,122))
CHAR(RANDBETWEEN(97,122)) & CHAR(RANDBETWEEN(97,122))
Untuk menghasilkan 6 karakter string (bebas) dan 2 angka, dapat dihasilkan dari formula berikut.
=CHAR(RANDBETWEEN(65,90))& CHAR(RANDBETWEEN(97,122)) &
CHAR(RANDBETWEEN(65,90)) & CHAR(RANDBETWEEN(97,122)) & CHAR(RANDBETWEEN(65,90))& CHAR(RANDBETWEEN(97,122)) &
CHAR(RANDBETWEEN(48,57)) & CHAR(RANDBETWEEN(48,57))
CHAR(RANDBETWEEN(65,90)) & CHAR(RANDBETWEEN(97,122)) & CHAR(RANDBETWEEN(65,90))& CHAR(RANDBETWEEN(97,122)) &
CHAR(RANDBETWEEN(48,57)) & CHAR(RANDBETWEEN(48,57))
Untuk menghasilkan 6 karakter string (bebas), 2 angka dan 2 simbol dapat dihasilkan dari formula berikut.
=CHAR(RANDBETWEEN(65,90))& CHAR(RANDBETWEEN(97,122)) &
CHAR(RANDBETWEEN(65,90)) & CHAR(RANDBETWEEN(97,122)) & CHAR(RANDBETWEEN(65,90))& CHAR(RANDBETWEEN(97,122)) &
CHAR(RANDBETWEEN(48,57)) & CHAR(RANDBETWEEN(33,47)) &
CHAR(RANDBETWEEN(48,57)) & CHAR(RANDBETWEEN(33,47))
CHAR(RANDBETWEEN(65,90)) & CHAR(RANDBETWEEN(97,122)) & CHAR(RANDBETWEEN(65,90))& CHAR(RANDBETWEEN(97,122)) &
CHAR(RANDBETWEEN(48,57)) & CHAR(RANDBETWEEN(33,47)) &
CHAR(RANDBETWEEN(48,57)) & CHAR(RANDBETWEEN(33,47))
Semoga bermanfaat.
Written with Windows Live Writer
Bambang F. Indarto, S.T.
MCPD, MOM, MCT, CEI, MVP
Bambang F. Indarto, S.T.
MCPD, MOM, MCT, CEI, MVP
No comments:
Post a Comment