Add a 0 to the start of a cell if the first number is a 7

tommo_5

New Member
Joined
Feb 24, 2009
Messages
3
Hello

I am running an extract to excel from a HR system at work which provides a mobile number for each employee. I need to add a 0 to all of the mobile numbers which begin with a 7 before i export the data to another system, is there an easy way to do this as i have over 1500 entries which need updating.

Thanks

JT
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Hi

use a helper column with a formula like:

=IF(LEFT(A1,1)="7","0","")&A1

I assume phone numbers are in A1:A...

Drag down the formula far enough. Then copy the cells and paste as values over column A cells. Clean up the helper column and you're done.

Wigi
 
Upvote 0
VBA Solution
Code:
For i = 1 To Range("A" & rows.count).End(xlUp).Row
    If Left(Range("A" & i).Value, 1) = "7" Then
        Range("A" & i).Value = "0" & Range("A" & i).Value
    End If
Next i

Does not need helper columns
 
Upvote 0

Forum statistics

Threads
1,224,527
Messages
6,179,337
Members
452,907
Latest member
Roland Deschain

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