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

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Ok thanks. I didn't see anything like that in there, but I wanted to ask the gurus :)
 
Upvote 0
Of course you could always define a formula to reformat your data in another column...

=IF(LEFT(A2)="9",TEXT(A2,"0"),A2)
 
Upvote 0
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>
 
Upvote 0

Forum statistics

Threads
1,214,894
Messages
6,122,124
Members
449,066
Latest member
Andyg666

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