PC Review


Reply
Thread Tools Rate Thread

Maximum Length of Text in Column

 
 
Joe
Guest
Posts: n/a
 
      18th Dec 2004
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
 
 
 
 
Ken Wright
Guest
Posts: n/a
 
      18th Dec 2004
=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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
 
Joe
Guest
Posts: n/a
 
      18th Dec 2004
Thanks

"Ken Wright" <(E-Mail Removed)> wrote in message
news:eY$$(E-Mail Removed)...
> =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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > 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
 
Joe
Guest
Posts: n/a
 
      18th Dec 2004
Ken

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

Thanks

"Ken Wright" <(E-Mail Removed)> wrote in message
news:eY$$(E-Mail Removed)...
> =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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > 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
 
JE McGimpsey
Guest
Posts: n/a
 
      18th Dec 2004
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 <(E-Mail Removed)>,
"Joe" <(E-Mail Removed)> wrote:

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

 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      18th Dec 2004
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" <(E-Mail Removed)> wrote in message
> news:eY$$(E-Mail Removed)...
> > =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" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> > > 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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Maximum length of TextBox.Text? Mark Erikson Microsoft Dot NET Compact Framework 3 23rd Jul 2010 09:03 PM
Text Form Field Maximum Character Length paankadu Microsoft Word Document Management 0 5th Feb 2010 04:15 PM
Maximum text string length in PST backup utility Kimbo Microsoft Outlook Discussion 3 24th Sep 2009 09:32 AM
Setting the maximum length of a text form field PaddyPenfold Microsoft Word Document Management 2 5th Dec 2007 02:21 PM
Maximum text length? L Buchy Microsoft Excel Programming 8 12th Sep 2003 03:09 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:58 PM.