Simple if/then statement- add text conditionally to cells

Gamermatt

Board Regular
Joined
May 14, 2009
Messages
186
Hello,

I have a list of cells in column A. Each cell is formatted like this:
93-95
81-08
71-77
07-11

Basically, i need to complete these years. So, if the number starts with a 7, 8, or 9, it should add 19 before it. If it starts with a 0 or 1, it should add a 20 before it.

So, it should look like this:
1993-1995
1981-2008
1971-1977
2007-2011

What is a fast way of doing this? I don't want to have to go through and find and replace each number. Although, i could use the wildcard * and use find a replace, example: find- 8* replace- 198* (but that does not seem to work)

Thanks,

Matt
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Try

=YEAR("1/1/"&LEFT(A1,2))&"-"&YEAR("1/1/"&RIGHT(A1,2))

the cutoff year is 30

29 = 2029
30 = 1930
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,603
Messages
6,179,854
Members
452,948
Latest member
UsmanAli786

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