taking characters from last name and first name to create a passwo

J

Juan

I need to create a password based on the first letter of the first name and
the first 3 letters of the last name along with a random number 1-9 at the
end. How can i do this? C1 below is where i want to enter the formula to
create the password.
thanks.

Example:
A1 B1 C1
LN FN New Password
Smith John Jsmi3
 
P

Phil

didn't type this in and test, but try this:

mid(A1,1,1) & mid(B1,1,3) & Trim(int(RND(0)*10))

something like that anyway...
 
T

Tom Ogilvy

=Left(B1,1)&left(A1,3)&trunc(rand()*9+1)

but each time you calculate, the number will change.
 
R

Rick Rothstein \(MVP - VB\)

Since you posted this in a programming newsgroup, I'm assuming you want VB
code...

PW = Left(Range("B1"), 1) & Left(Range("A1"), 3) & (Int(10 * Rnd()) + 1)

Rick
 
R

Rick Rothstein \(MVP - VB\)

What's RANDBETWEEN? Not in Excel 2003

It requires the Analysis ToolPak add-in to be loaded.

Rick
 
J

Juan

Thanks Tom, Per and Charlie. All of yours work perfectly. This made things so
much easier for me.
 
T

Tom Ogilvy

Just a heads up,

Int(10 * Rnd()) + 1

generates random numbers between 1 and 10 inclusive vice the 1-9 asked for.
 
R

Rick Rothstein \(MVP - VB\)

I guess I typed that too fast... thanks. Although, based on his last
posting, the OP appears to not want a VB solution (even though he posted to
a programming newsgroup), here is the corrected formula for the archives...

PW = Left(Range("B1"), 1) & Left(Range("A1"), 3) & (Int(9 * Rnd()) + 1)

Rick
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top