Count length of text characters in a cell that has a formula

DoctorK

New Member
Joined
Dec 1, 2016
Messages
12
I've searched everywhere! The COUNTIF/COUNTA isn't what I need. The spreadsheet is like this:
example
Code:
[B]Column D                              Col N                           Col O[/B]
Name/Description              External calling name                   Char Count
Bobby                                   Bobby                           5

Column N has a formula to return Col D's value if Column B has 10 numbers in it:
example:
Code:
=IF(LEN($B36)=10,$N$34,"")

This works great and it returns the proper char count.

However, whenever there isn't a name to return, Column O returns a '1' when the cell is blank.

What I'm looking for is for it to return nothing at all and I can't seem to find why it's returning a '1'.


Thank you for your time. :)
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
@DoctorK, I'm not sure why the formula you listed refers to row 36 in Column B, but row 34 in Column N. Typo?

At any rate, I'm guessing you've got a blank between quotes in N, rather than a true null (i.e., quotation marks one right after the other with no space between them).

You can test for this in O (assuming we're both talking about row 36):

Code:
=LEN(TRIM(N36))

Or you could test for the space by putting this formula temporarily in O36:

Code:
CODE(N36)

If you get the number 32, then you've got a space instead of a null in your Column-N formula.
 
Upvote 0
Referring to row 36 in Column B, basically states that if there is a 10 digit number in the B column, to populate the description name from another cell - in which case it's N34. Otherwise leave blank.

All of col N from N36 on down has this formula in it.
The O col is just the char count and states that I only want to count the chars in the cell of the formula.

At first I tried using
Rich (BB code):
=IF(N37<>"","",(LEN(N37)))
but, it doesn't return the len of the cell if it is populated.

The TRIM function doesn't omit the '1' if the cell is blank.
Rich (BB code):
 =LEN(TRIM(N36)) 


I tried using
Rich (BB code):
CODE(N36)

and I get the value of 48 when there is nothing in N36

It's not such a big deal, because it does count the number of chars correctly if there is something in the cell. I'm just puzzled as to why it counts '1' when there isn't anything in the cell but the formula.


 
Upvote 0
If you're getting a 48 on CODE(), Excel sees an actual zero there, not a null.

You can always use a workaround:

=IF(CODE(N36) > 48,LEN(N36),"")

And the reason your IF() formula above produced no results is that you reversed the TRUE and FALSE clauses. You basically said, "If that cell isn't blank, make this one blank. If it IS blank, tell me the length of that blank cell." You wanted:

=IF(N36<>"",LEN(N36),"")

or

=IF(N36="","",LEN(N36))
 
Upvote 0

Forum statistics

Threads
1,213,531
Messages
6,114,167
Members
448,554
Latest member
Gleisner2

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