Len(), counting?

srizki

Well-known Member
Joined
Jan 14, 2003
Messages
1,860
Office Version
  1. 365
Platform
  1. Windows
I have the following number and LEN() formula,
As you can see that LEN(), counting 15 for all other and 16 for the last one, while they all 16 characters long.

<form id="form" onkeypress="javascript:return WebForm_FireDefaultButton(event, 'cphMain_btnSearch')" onsubmit="javascript:return WebForm_OnSubmit();" action="./InboundSearch.aspx?PageMode=Invoices" method="post">
</form>[TABLE="width: 188"]
<tbody>[TR]
[TD="align: right"]00420170080213373[/TD]
[TD="align: right"]15[/TD]
[/TR]
[TR]
[TD="align: right"]00520170080210373[/TD]
[TD="align: right"]15[/TD]
[/TR]
[TR]
[TD="align: right"]00720170080210730[/TD]
[TD="align: right"]15[/TD]
[/TR]
[TR]
[TD="align: right"]00820170080210730[/TD]
[TD="align: right"]15[/TD]
[/TR]
[TR]
[TD="align: right"]00820170080210732[/TD]
[TD="align: right"]15[/TD]
[/TR]
[TR]
[TD="align: right"]00920170080210730[/TD]
[TD="align: right"]15[/TD]
[/TR]
[TR]
[TD="align: right"]00920170080210731[/TD]
[TD="align: right"]15[/TD]
[/TR]
[TR]
[TD="align: right"]01020170080210730[/TD]
[TD="align: right"]16[/TD]
[/TR]
</tbody><colgroup><col><col></colgroup>[/TABLE]


Please advise what I am doing wrong.

Thanks
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Hello Sohail,

You have the numbers formatted to display leading zeroes. The LEN() function only returns the count of real digits in the number.
 
Upvote 0
Thanks,
I am sure I had some other problem, I forgot, it was not that obvious.
 
Upvote 0
The data on the left should be entered as text. Then LEN would work as desired. Well, maybe not: LEN would return 17 for all of them.

However, the 16-character "number" (identifier) is suspicious. Although that is with the range of 16-digit numbers that Excel can represent exactly (<= 2^53), you cannot only type zero as the last digit, because Excel truncates data entry after the 15th digit, replacing any others to the right with zeros.
 
Upvote 0
you cannot only type zero as the last digit, because Excel truncates data entry after the 15th digit, replacing any others to the right with zeros.

Aarrgghh!! That should say "you can only type zero as the last digit".
 
Upvote 0

Forum statistics

Threads
1,223,902
Messages
6,175,278
Members
452,629
Latest member
SahilPolekar

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