first name and a second name - In Sheet2 I only need the first name

  • Thread starter Thread starter tegger
  • Start date Start date
T

tegger

Sheet1 Range A2 contains a first name and a second name.

Sheet2 Range A2 contains =(Sheet1!A2)

In Sheet2 I only need the first name.

Can I do this with a formula?



Thanks,

DL
 
Take a look at the Mid/Instr functions or Split function. In either case,
the first name/last name must have a delimitter to distinguish them (space,
comma, etc.). Both of the following cases assume comma delimitted.

Using Mid/Instr functions:

Mid(rng.Value, 1, InStr(sFullName, " ") - 1)

Using Split function (1st array member contains first name, 2nd array member
contains last name):

aryTemp = Split(sFullName)


Bill Barclift
 
=IF(ISERROR(FIND(" ",Sheet1!A2)),Sheet1!A2,LEFT(Sheet1!A2,FIND("
",Sheet1!A2)-1))

Regards

Trevor
 
Back
Top