Find and Replace only the first character

T

Terry Willard

I am trying to replace only the first number in a date.
example: 6/6/10 with 7/6/10
I am doing a find 6/ and a replace 7/ but it changes the 7/6 to 7/7 and I
only want to look at the first number in the date. Can anyone help me????
 
L

Luke M

Use the 4th arguement to state that you only want to change the first
instance.

=SUBSTITUTE(A2,"6","7",1)

This premise does assume that you have dates stored as text. If you have
them stored as numbers (preferred), you can do:
=DATE(YEAR(A2),7,DAY(A2))
 
T

tompl

Assuming that your date format is Month, Day, Year you could use the
following formula to compute the change from June to July. Other months
would not be affected.

First, assuming your original date is in cell A2, put this formula in Cell B2:
=IF(MONTH(A2)=6,DATE(YEAR(A2),7,DAY(A2)),A2)

Next, Paste-Special-Values from Cell B2 to Cell A2. Then you can clear the
contents of Cell B2.

Tom
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top