SUMPRODUCT and MAX LEN for Structured Table

Hi Excel function experts,

I've a problem with a non-array SumProduct formula that isn't working with a Structured Table.
My system: Excel 2013, 32-bit (on Win7)

I'd like to get the max length of a column of text values in Table1, which is as below.
The answer I'm looking for is 6 (ie. the length of the last word, "longer").

The answer I get seems to depend on the cell location of my formula.
If its on the same row as dog, I get 3.
Next row I get 2
Last row I get 6, which is the correct answer.
In other words, it seems as though my column reference is just returning the first row, and is not an absolute column reference.

Table1:
Values
---------
dog
hi
longer                            

Open in new window

My formula is as follows:
=SUMPRODUCT(MAX(LEN(Table1[Values]))*1)

Open in new window

It evaluates fine via F9:
=SUMPRODUCT(MAX({3;2;6})*1)
=SUMPRODUCT(6*1)
=6

Open in new window

And it evaluates fine if array-entered (ie. Ctrl Shift Enter)
But I've never had to do that with Sumproduct during the past 10 years.

Having not kept pace with Excel's changes for a few years, it might be to do with my ignorance of structured table references.
But 'maybe' its to do with SumProduct and structured tables.
If the latter, I'm then wondering if anyone has any suggestions, or a neat non-array alternative.

For example, I can get it to work with this:
(where 9.99+E100 is a suitably large number, and the match with type 1 returns the next largest number)
=INDEX(LEN(Table1[Values]),MATCH(9.99+E100,INDEX(LEN(Table1[Values]),0,1),1))

Open in new window

That formula suggests the column reference is working fine.
But it's an ugly formula for someone else to have to work out (or me to figure out in a year's time).
I'd much prefer a simple SUMPRODUCT (or something similar snappy, and non-array entered).
Or maybe even a total row at the bottom of the structured table that returns the Max Length.

Any suggestions?

Many thanks in advance,
Chris
ChrisSelf EmployedAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ShumsDistinguished Expert - 2017Commented:
Try below:
=SUMPRODUCT(MAX(LEN(Table1[[#Headers],[Values]]))*1)

Open in new window

Or:
=MAX(LEN(Table1[[#Headers],[Values]]))

Open in new window

1

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ChrisSelf EmployedAuthor Commented:
*Pow*...that's done the job, and pronto to boot, thanks very much Shums!
Furthermore, its improved the function without the SumProduct, cheers.

Looks like it was my ignorance of structured table references...I'll have to look further at those.

Many thanks again Shums, much appreciated!
0
ShumsDistinguished Expert - 2017Commented:
Try this as well
=MAX(LEN(Table1[Values]))

Open in new window

Confirmed with Ctrl+Shift+Enter
0
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

ChrisSelf EmployedAuthor Commented:
Yeah I couldn't get the last one to work ie. =MAX(LEN(Table1[Values]))
(aside from using CSE)

That's why I went the SumProduct route, thinking that perhaps structured tables didn't support arrays for functions such as =Max(Len(values)).
Clearly they do though, as shown by your solution:
=MAX(LEN(Table1[[#Headers],[Values]]))

Open in new window

Definitely handy tools these structured tables...I'll have to invest some time to work them out :)
0
ShumsDistinguished Expert - 2017Commented:
Chris,

have you tried with Ctrl+Shift+Enter?

Its an Array Formula,

Last one will work even you gonna expand your list.
0
ShumsDistinguished Expert - 2017Commented:
See the difference:
It will work if there will be no changes in your table, but if you gonna expand your list it wont work, see difference below:
with =MAX(LEN(Table1[[#Headers],[Values]]))
MaxLength-1with = =MAX(LEN(Table1[Values])) confirmed with Ctrl+Shift+Array
MaxLength-2
1
ChrisSelf EmployedAuthor Commented:
Ah...I think I see what you mean.

Just tested it, and it seems that if you enter your second formula below, its not dynamic in that it doesn't account for table additions.
=MAX(LEN(Table1[[#Headers],[Values]]))

Open in new window

In that case, I'd probably stick with your first formula, the SUMPRODUCT approach, because that does seem to account for table additions.
=SUMPRODUCT(MAX(LEN(Table1[[#Headers],[Values]]))*1)

Open in new window

I prefer to avoid array functions, for the reason of which you're no doubt aware, because its easy to blow up the formula.
Eg. if someone enters and exits that cell and doesn't understand that its an array formula, then the curly braces are gone!

Your formula works perfectly though!
Many thanks again Shums :)
0
ShumsDistinguished Expert - 2017Commented:
You're Welcome Chris! I am glad I was able to help.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Office

From novice to tech pro — start learning today.