Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
dave55
 
Posts: n/a
Default How do I do conditional formatting on number formats not patterns.

Cell A1 is a drop down list that you select either "A" or "P". Cell B1 is a
cell where the user enters a number. If A1 is "A" I want the number in B1 to
show as an amount in $ whereas if A1 is "P" i want B1 to show as a percentage.

The conditional formatting option allows me to change fonts, borders, and
patterns but not the number format.

Any help would be appreciated

  #2   Report Post  
Jason Morin
 
Posts: n/a
Default

Right-click on the worksheet tab, go to View Code, and
paste in the code below. Press ALT+Q to close VBE.

Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo ExitThisSub
If Not Intersect(Target, Me.[A1]) Is Nothing Then
Application.EnableEvents = False
With Target
If .Value = "A" Then
.Offset(0, 1).NumberFormat = "$#,##0.00"
Else
.Offset(0, 1).NumberFormat = "0.0%"
End If
End With
End If
ExitThisSub:
Application.EnableEvents = True
End Sub

---
HTH
Jason
Atlanta, GA

-----Original Message-----
Cell A1 is a drop down list that you select either "A"

or "P". Cell B1 is a
cell where the user enters a number. If A1 is "A" I want

the number in B1 to
show as an amount in $ whereas if A1 is "P" i want B1 to

show as a percentage.

The conditional formatting option allows me to change

fonts, borders, and
patterns but not the number format.

Any help would be appreciated

.

  #3   Report Post  
Max
 
Posts: n/a
Default

Just a formula play to tinker around with in the interim
(its probably not what you're after)

We could put in C1, something like:

=IF(A1="","Select an option in col
A",IF(A1="A",TEXT(B1,"$#,##0.00"),TEXT(B1,"0%") ))

and copy C1 down

Col C will return the number entered in col B as text* in the display format
desired depending on the selection made in col A

*To enable downstream calcs refering to inputs made in col B, either point
direct at col B's values, or point at col C's values but include a "+0",
e.g.: =C1+0 to coerce the text in col C to real numbers

Do hang around for better insights from others to your post
--
Rgds
Max
xl 97
---
GMT+8, 1° 22' N 103° 45' E
xdemechanik <atyahoo<dotcom
----
"dave55" wrote in message
...
Cell A1 is a drop down list that you select either "A" or "P". Cell B1 is

a
cell where the user enters a number. If A1 is "A" I want the number in B1

to
show as an amount in $ whereas if A1 is "P" i want B1 to show as a

percentage.

The conditional formatting option allows me to change fonts, borders, and
patterns but not the number format.

Any help would be appreciated



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Conditional Formatting in Excel Help Please..... Willie T Excel Discussion (Misc queries) 4 February 9th 05 02:28 PM
Conditional formatting row when cell value is an even number hhunt Excel Worksheet Functions 5 February 2nd 05 09:29 PM
Determine cells that drive conditional formatting? Nicolle K. Excel Discussion (Misc queries) 2 January 7th 05 01:08 AM
Conditional formatting not available in Excel BAB Excel Discussion (Misc queries) 2 January 1st 05 03:33 PM
Conditional Formatting (Date vs Number) [email protected] Excel Discussion (Misc queries) 7 December 20th 04 10:23 PM


All times are GMT +1. The time now is 07:06 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"