Max Length of a field with Errors

tyija1995

Well-known Member
Joined
Feb 26, 2019
Messages
781
Office Version
  1. 365
Platform
  1. Windows
Hi,

I want to find the maximum length of each field taking into account of errors that pop up.

For example I have data in cells A2:B938,

Column A is the ID number and Column B is a description,

I am using the following formula to get the max length:
{=MAX(LEN(A2:A938))} and similarly B2:B938 for column B
The first formula returns 3 (which is correct as the IDs go up to 952) but the 2nd formula returns #NAME ? as I have some errors in column B

Is there a formula I can use to bypass the errors and return the longest valid cell in column B? I have tried with AGGREGATE but can't quite get it to work...

Thanks.
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Try
Code:
=MAX(LEN(IFERROR(B2:B5,"")))
confirm with Ctr-Shift-Del
 
Upvote 0
Hi Scott,

Thank you for the quick reply it has worked, much appreciated! :D
 
Upvote 0
How about this non array version
=AGGREGATE(14,6,(LEN(B2:B28)),1)
 
Last edited:
Upvote 0
Thank you Fluff that has also worked! Very nice to see it done without an array formula, they always seem to trip me up as I am fairly new to learning them!
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,223,894
Messages
6,175,254
Members
452,624
Latest member
gregg777

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top