# Get character count across a row of cells in excel 2007

I know by using the formula, =IF(LEN(A1)=1,1,LEN(A1)) , I can get the character count for cell A1, but what if I want the character count of A1 + B1 + C1...etc? I have over 20,000 rows of data and I was hoping I could copy a formula to put at the end of each one to know how many characters there are in each row. I am looking for rows that are over a certain size (so I could copy and paste the results as values in another row and then filter/sort it)
###### Who is Participating?

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.

Commented:
For the total characters in A1:Z1

=SUMPRODUCT(LEN(A1:Z1))

regards, barry
0

Experts Exchange Solution brought to you by

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

Author Commented:
PERFECT! Many thanks!
0
Commented:
Try the following code.
I am assuming that each row has the same column so you could just populate the 1st row and autofilter all the way down.
``````Sub Macro1()
Dim i As Integer
Dim j As Integer
Dim str As String

i = ActiveSheet.UsedRange.Columns.Count

For j = 1 To i
str = str & "len(" & Cells(1, j).Address & ")+"
Next

str = Left(str, Len(str) - 1)
str = "=" & str
str = WorksheetFunction.Substitute(str, "\$", "")
Cells(1, j).Value = str

End Sub
``````
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 Excel

From novice to tech pro — start learning today.