Excel Function

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
 
T

Tom Ogilvy

Dim varr as Variant
varr = Array("Jerry","Tom","Dave","Mark")
msgbox varr(lbound(varr))
 
K

kiat

=LEFT(A1,FIND(",",A1)-1)

if (Jerry, Tom, Dave, Mark) is in A1, then above will return Jerry
 
A

Alan Beban

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
 

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