Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8
Default Converting a cell value

I have a worksheet that is imported from another application. One column
involves a Model Year of a vehicle and the last two digits of the year is
imported and leading zeros are deleted. That means that I have a column with
single digit numbers 0 through 8 representing 2000 through 2008. I also have
a few two digit numbers...98, 99, 93, etc., representing 1998, 1999, 1993
model years of vehicles. I am trying to come up with a formula to convert
this column of 1 or two digit numbers to the correct model year. If the cell
has a 0 through 9 in it, I want it to convert to 2000 to 2009. If it has a
two digit number of anykind (XX), I want it to convert to 19XX. I just can't
figure out what the formula would be to do this and all kinds of searching
hasn't led me anywhere. Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default Converting a cell value


Hi, how are your digits formatted, text or numbers?


--
Pecoflyer
------------------------------------------------------------------------
Pecoflyer's Profile: http://www.thecodecage.com/forumz/member.php?userid=14
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=24064

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
shg shg is offline
external usenet poster
 
Posts: 1
Default Converting a cell value


You can use =1900+(A1<=9)*100+A1, and change the 9 to whatever number
you want to break between 1900 and 2000.


--
shg
------------------------------------------------------------------------
shg's Profile: http://www.thecodecage.com/forumz/member.php?userid=13
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=24064

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5,651
Default Converting a cell value

On Sat, 1 Nov 2008 10:16:00 -0700, Hawk wrote:

I have a worksheet that is imported from another application. One column
involves a Model Year of a vehicle and the last two digits of the year is
imported and leading zeros are deleted. That means that I have a column with
single digit numbers 0 through 8 representing 2000 through 2008. I also have
a few two digit numbers...98, 99, 93, etc., representing 1998, 1999, 1993
model years of vehicles. I am trying to come up with a formula to convert
this column of 1 or two digit numbers to the correct model year. If the cell
has a 0 through 9 in it, I want it to convert to 2000 to 2009. If it has a
two digit number of anykind (XX), I want it to convert to 19XX. I just can't
figure out what the formula would be to do this and all kinds of searching
hasn't led me anywhere. Thanks.


=A1+1900+100*(A1<30)

So any two digit number less than 30 is presumed to represent a date in this
century; if it is 30-99 it represents a date in the last century.
--ron
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5,934
Default Converting a cell value

If we assume the OP has not modified the normal break point for determining
the century in his Windows regional setting (default is the 30 you are using
in your formula), then this shorter formula can be used...

=YEAR("1/1/"&A1)

--
Rick (MVP - Excel)


"Ron Rosenfeld" wrote in message
...
On Sat, 1 Nov 2008 10:16:00 -0700, Hawk
wrote:

I have a worksheet that is imported from another application. One column
involves a Model Year of a vehicle and the last two digits of the year is
imported and leading zeros are deleted. That means that I have a column
with
single digit numbers 0 through 8 representing 2000 through 2008. I also
have
a few two digit numbers...98, 99, 93, etc., representing 1998, 1999, 1993
model years of vehicles. I am trying to come up with a formula to convert
this column of 1 or two digit numbers to the correct model year. If the
cell
has a 0 through 9 in it, I want it to convert to 2000 to 2009. If it has
a
two digit number of anykind (XX), I want it to convert to 19XX. I just
can't
figure out what the formula would be to do this and all kinds of searching
hasn't led me anywhere. Thanks.


=A1+1900+100*(A1<30)

So any two digit number less than 30 is presumed to represent a date in
this
century; if it is 30-99 it represents a date in the last century.
--ron




  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,344
Default Converting a cell value

Hi,

And if you want a still shorter formula

=--("1/1/"&A1)


--
Thanks,
Shane Devenshire


"Rick Rothstein" wrote:

If we assume the OP has not modified the normal break point for determining
the century in his Windows regional setting (default is the 30 you are using
in your formula), then this shorter formula can be used...

=YEAR("1/1/"&A1)

--
Rick (MVP - Excel)


"Ron Rosenfeld" wrote in message
...
On Sat, 1 Nov 2008 10:16:00 -0700, Hawk
wrote:

I have a worksheet that is imported from another application. One column
involves a Model Year of a vehicle and the last two digits of the year is
imported and leading zeros are deleted. That means that I have a column
with
single digit numbers 0 through 8 representing 2000 through 2008. I also
have
a few two digit numbers...98, 99, 93, etc., representing 1998, 1999, 1993
model years of vehicles. I am trying to come up with a formula to convert
this column of 1 or two digit numbers to the correct model year. If the
cell
has a 0 through 9 in it, I want it to convert to 2000 to 2009. If it has
a
two digit number of anykind (XX), I want it to convert to 19XX. I just
can't
figure out what the formula would be to do this and all kinds of searching
hasn't led me anywhere. Thanks.


=A1+1900+100*(A1<30)

So any two digit number less than 30 is presumed to represent a date in
this
century; if it is 30-99 it represents a date in the last century.
--ron



  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,651
Default Converting a cell value

.... though of course that will give the date, rather than the year.
--
David Biddulph

"ShaneDevenshire" wrote in
message ...
Hi,

And if you want a still shorter formula

=--("1/1/"&A1)


--
Thanks,
Shane Devenshire


"Rick Rothstein" wrote:

If we assume the OP has not modified the normal break point for
determining
the century in his Windows regional setting (default is the 30 you are
using
in your formula), then this shorter formula can be used...

=YEAR("1/1/"&A1)

--
Rick (MVP - Excel)


"Ron Rosenfeld" wrote in message
...
On Sat, 1 Nov 2008 10:16:00 -0700, Hawk

wrote:

I have a worksheet that is imported from another application. One
column
involves a Model Year of a vehicle and the last two digits of the year
is
imported and leading zeros are deleted. That means that I have a
column
with
single digit numbers 0 through 8 representing 2000 through 2008. I
also
have
a few two digit numbers...98, 99, 93, etc., representing 1998, 1999,
1993
model years of vehicles. I am trying to come up with a formula to
convert
this column of 1 or two digit numbers to the correct model year. If
the
cell
has a 0 through 9 in it, I want it to convert to 2000 to 2009. If it
has
a
two digit number of anykind (XX), I want it to convert to 19XX. I just
can't
figure out what the formula would be to do this and all kinds of
searching
hasn't led me anywhere. Thanks.

=A1+1900+100*(A1<30)

So any two digit number less than 30 is presumed to represent a date in
this
century; if it is 30-99 it represents a date in the last century.
--ron





  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5,651
Default Converting a cell value

On Sun, 2 Nov 2008 01:19:57 -0500, "Rick Rothstein"
wrote:

If we assume the OP has not modified the normal break point for determining
the century in his Windows regional setting (default is the 30 you are using
in your formula), then this shorter formula can be used...

=YEAR("1/1/"&A1)

--
Rick (MVP - Excel)


True. But I wonder which would execute more quickly. :-)
--ron
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Converting a date to a text field w/o converting it to a julian da LynnMinn Excel Worksheet Functions 2 March 6th 08 03:43 PM
Converting a Cell Value to a Different Value Freeneasy Excel Worksheet Functions 2 February 10th 07 03:44 AM
Converting a cell into a comment pasbillhen Excel Discussion (Misc queries) 1 November 17th 06 05:50 PM
Cell borders when converting 123 doc to xls marmur1 Excel Discussion (Misc queries) 1 June 2nd 06 09:04 AM
Converting cell ref. w/num to currency lulanosk Excel Worksheet Functions 1 September 26th 05 09:49 AM


All times are GMT +1. The time now is 04:42 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"