PC Review Forums Newsgroups Microsoft Excel Microsoft Excel Discussion Maximum Length of Text in Column

Reply

Maximum Length of Text in Column

 
Thread Tools Rate Thread
Old 18-12-2004, 03:13 PM   #1
Joe
Guest
 
Posts: n/a
Default Maximum Length of Text in Column


Is there a function that will return the maximum lengh of a text in a
column. Eg.

a3: Text1
a4: Text1Text2
a5: Text1Text2Text3

Thus a formula that returns 15 a the maximum length.

Thanks in advance


  Reply With Quote
Old 18-12-2004, 03:25 PM   #2
Ken Wright
Guest
 
Posts: n/a
Default Re: Maximum Length of Text in Column

=MAX(LEN(A1:A100)) array entered using CTRL+SHIFT+ENTER

--
Regards
Ken....................... Microsoft MVP - Excel
Sys Spec - Win XP Pro / XL 97/00/02/03

----------------------------------------------------------------------------
It's easier to beg forgiveness than ask permission :-)
----------------------------------------------------------------------------



"Joe" <Joe@xxxxxxxxxxxxxxxxxxx.com> wrote in message
news:OPAlatQ5EHA.4040@TK2MSFTNGP14.phx.gbl...
> Is there a function that will return the maximum lengh of a text in a
> column. Eg.
>
> a3: Text1
> a4: Text1Text2
> a5: Text1Text2Text3
>
> Thus a formula that returns 15 a the maximum length.
>
> Thanks in advance
>
>



  Reply With Quote
Old 18-12-2004, 03:32 PM   #3
Joe
Guest
 
Posts: n/a
Default Re: Maximum Length of Text in Column

Thanks

"Ken Wright" <ken.wright@NOSPAMntlworld.com> wrote in message
news:eY$$o1Q5EHA.2452@TK2MSFTNGP14.phx.gbl...
> =MAX(LEN(A1:A100)) array entered using CTRL+SHIFT+ENTER
>
> --
> Regards
> Ken....................... Microsoft MVP - Excel
> Sys Spec - Win XP Pro / XL 97/00/02/03
>
> --------------------------------------------------------------------------

--
> It's easier to beg forgiveness than ask permission :-)
> --------------------------------------------------------------------------

--
>
>
>
> "Joe" <Joe@xxxxxxxxxxxxxxxxxxx.com> wrote in message
> news:OPAlatQ5EHA.4040@TK2MSFTNGP14.phx.gbl...
> > Is there a function that will return the maximum lengh of a text in a
> > column. Eg.
> >
> > a3: Text1
> > a4: Text1Text2
> > a5: Text1Text2Text3
> >
> > Thus a formula that returns 15 a the maximum length.
> >
> > Thanks in advance
> >
> >

>
>



  Reply With Quote
Old 18-12-2004, 03:40 PM   #4
Joe
Guest
 
Posts: n/a
Default Re: Maximum Length of Text in Column

Ken

How can you macroise the array into the cell using VBA?

Thanks

"Ken Wright" <ken.wright@NOSPAMntlworld.com> wrote in message
news:eY$$o1Q5EHA.2452@TK2MSFTNGP14.phx.gbl...
> =MAX(LEN(A1:A100)) array entered using CTRL+SHIFT+ENTER
>
> --
> Regards
> Ken....................... Microsoft MVP - Excel
> Sys Spec - Win XP Pro / XL 97/00/02/03
>
> --------------------------------------------------------------------------

--
> It's easier to beg forgiveness than ask permission :-)
> --------------------------------------------------------------------------

--
>
>
>
> "Joe" <Joe@xxxxxxxxxxxxxxxxxxx.com> wrote in message
> news:OPAlatQ5EHA.4040@TK2MSFTNGP14.phx.gbl...
> > Is there a function that will return the maximum lengh of a text in a
> > column. Eg.
> >
> > a3: Text1
> > a4: Text1Text2
> > a5: Text1Text2Text3
> >
> > Thus a formula that returns 15 a the maximum length.
> >
> > Thanks in advance
> >
> >

>
>



  Reply With Quote
Old 18-12-2004, 04:31 PM   #5
JE McGimpsey
Guest
 
Posts: n/a
Default Re: Maximum Length of Text in Column

I'm pretty shaky on what "macroise the array into the cell" could mean,
but if you mean to use a macro to enter the array-formula Ken gave you
into a cell, take a look at the FormulaArray property in XL/VBA Help.
One way:


Range("B1").FormulaArray = "=MAX(LEN(R1C1:R100C1))"


In article <u8MOs8Q5EHA.156@TK2MSFTNGP10.phx.gbl>,
"Joe" <Joe@xxxxxxxxxxxxxxxxxxx.com> wrote:

> How can you macroise the array into the cell using VBA?

  Reply With Quote
Old 18-12-2004, 04:47 PM   #6
Dave Peterson
Guest
 
Posts: n/a
Default Re: Maximum Length of Text in Column

You could loop through each of the cells looking for a longer string or you
could ask excel to evaluate your formula:

One way to ask:

Option Explicit
Sub testme()

Dim myRng As Range

With Worksheets("sheet1")
Set myRng = .Range("a1", .Cells(.Rows.Count, "A").End(xlUp))
End With

MsgBox Application.Evaluate("max(len(" _
& myRng.Address(external:=True) & "))")

End Sub

Joe wrote:
>
> Ken
>
> How can you macroise the array into the cell using VBA?
>
> Thanks
>
> "Ken Wright" <ken.wright@NOSPAMntlworld.com> wrote in message
> news:eY$$o1Q5EHA.2452@TK2MSFTNGP14.phx.gbl...
> > =MAX(LEN(A1:A100)) array entered using CTRL+SHIFT+ENTER
> >
> > --
> > Regards
> > Ken....................... Microsoft MVP - Excel
> > Sys Spec - Win XP Pro / XL 97/00/02/03
> >
> > --------------------------------------------------------------------------

> --
> > It's easier to beg forgiveness than ask permission :-)
> > --------------------------------------------------------------------------

> --
> >
> >
> >
> > "Joe" <Joe@xxxxxxxxxxxxxxxxxxx.com> wrote in message
> > news:OPAlatQ5EHA.4040@TK2MSFTNGP14.phx.gbl...
> > > Is there a function that will return the maximum lengh of a text in a
> > > column. Eg.
> > >
> > > a3: Text1
> > > a4: Text1Text2
> > > a5: Text1Text2Text3
> > >
> > > Thus a formula that returns 15 a the maximum length.
> > >
> > > Thanks in advance
> > >
> > >

> >
> >


--

Dave Peterson
  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off