Excel Function

  • Thread starter Thread starter Shashi Bhosale
  • Start date Start date
S

Shashi Bhosale

Hi,

I have a cell with value (Jerry, Tom, Dave, Mark), i want to find first
value (that is Jerry) from the list.
Which function i can use to acheive this.

Thanks in advance,

Shashi
 
Dim varr as Variant
varr = Array("Jerry","Tom","Dave","Mark")
msgbox varr(lbound(varr))
 
=LEFT(A1,FIND(",",A1)-1)

if (Jerry, Tom, Dave, Mark) is in A1, then above will return Jerry
 
Or slightly more general

Dim x, varr
x = Range("A1").TextToColumns(DataType:=xlDelimited, _
ConsecutiveDelimiter:=True, Space:=True, Comma:=True)
varr = Range("a1", Range("a1").End(xlToRight))
MsgBox varr(LBound(varr), LBound(varr))

You posted in . . .programming, but if you just wanted a worksheet
formula, and only for the first name

=MID(A2,1,FIND(",",A2)-1)

Alan Beban
 
Back
Top