Is my Len not working??

spcalan

Well-known Member
Joined
Jun 4, 2008
Messages
1,247
I have a date 5/28/2008

I used Len() and it gives me the value of 5.

Shouldnt it be 9?
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
nope, dates are stored as numbers,

Jan 1 1900 = 1
Jan 2 1900 = 2
etc..
5/28/2008 = 39596 (5 characters)...

Try

Len(Text(A1,"m/dd/yyyy")

Hope this helps...
 
Upvote 0
Hi

Dates are actually held as Integer numbers in Excel and that date is actually the number

39596

whose length is 5. try changing the number format of your date cells to:

0

to see what I mean.
 
Upvote 0
More important question is Why are you using Len on a date? What is the ultimate goal, are you trying to extract the month or day from the date??
 
Upvote 0
I have a date 5/28/2008

I used Len() and it gives me the value of 5.

Shouldnt it be 9?

5/28/2008 is actually a 5 digit number, hence the result LEN returns.

On the other hand...

=LEN(TEXT(A2,"m/d/yyyy"))

would return what you expected.
 
Upvote 0

Forum statistics

Threads
1,214,413
Messages
6,119,374
Members
448,888
Latest member
Arle8907

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