ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Simple Excel Question? (https://www.excelbanter.com/excel-programming/393129-simple-excel-question.html)

Jo[_2_]

Simple Excel Question?
 
Hi everone,

Say I have in one cell this: 1/2/2007 and I want to use function
Right(cell, 5) to extract the year only......

Instead, I get number like 39264?! How can I extract the year from
thing like 1/2/2007?

Thanks,
Mike


Chip Pearson

Simple Excel Question?
 
Jo,

The reason you get a number like 39264 is because that is how dates are
stored internally. A date is stored as the number of days since 0-Jan-1900.
1 = 1-Jan-1900, 2 = 2-Jan-1900, ... 39274 = 11-July-2007. When you take the
RIGHT of the cell, you are taking the right characters of the number of the
date serial number, not the formatted date in the cell. This will return a
number like the 39264 you encountered.

To get the year, use the YEAR function. E.g.,

=YEAR(A1)


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting
www.cpearson.com
(email on the web site)

"Jo" wrote in message
ups.com...
Hi everone,

Say I have in one cell this: 1/2/2007 and I want to use function
Right(cell, 5) to extract the year only......

Instead, I get number like 39264?! How can I extract the year from
thing like 1/2/2007?

Thanks,
Mike



[email protected]

Simple Excel Question?
 

Charles May wrote:
=YEAR(cell)

"Jo" wrote in message
ups.com...
Hi everone,

Say I have in one cell this: 1/2/2007 and I want to use function
Right(cell, 5) to extract the year only......

Instead, I get number like 39264?! How can I extract the year from
thing like 1/2/2007?

Thanks,
Mike


Go to Cells/Format/Custom and use yyyyy. That will show you only the
year. You can scroll the custom box to see other variations.



All times are GMT +1. The time now is 05:44 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com