Find and Replace only the first character
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???? |
Find and Replace only the first character
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)) -- Best Regards, Luke M "Terry Willard" <Terry wrote in message ... 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???? |
Find and Replace only the first character
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 |
Find and Replace only the first character
Thank you so much! This was VERY helpful!!!!!
"tompl" wrote: 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 |
All times are GMT +1. The time now is 09:54 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com