Conditional Question

L

Legacy 5596

Guest
Using the Conditional formating, I'd like to look at the first number in cell A2 and if that number begins with a 9 I'd like to format the cell as TEXT, otherwise leave it general. -- Can this be done?
(no VB please)
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
L

Legacy 5596

Guest
Ok thanks. I didn't see anything like that in there, but I wanted to ask the gurus :)
 

Mark W.

MrExcel MVP
Joined
Feb 10, 2002
Messages
11,654
Of course you could always define a formula to reformat your data in another column...

=IF(LEFT(A2)="9",TEXT(A2,"0"),A2)
 

Mudface

MrExcel MVP
Joined
Feb 18, 2002
Messages
3,339
If you're willing to give VBA a shot, right-click on the sheet tab, select view code and copy and paste in the following: -
<pre>
Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Count > 1 Then Exit Sub
If Left(Target, 1) = "9" Then
Target.NumberFormat = "@"
Else:
Target.NumberFormat = "General"
End If

End Sub
</pre>
 

Forum statistics

Threads
1,144,510
Messages
5,724,774
Members
422,576
Latest member
kayth891

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
Top