Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / General Excel Questions / May 2008

Tip: Looking for answers? Try searching our database.

Custom Cell Format - Please help!

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
michael.beckinsale - 28 May 2008 10:40 GMT
Hi All,

I am trying to format cells so that if the resultant % is >100% or <
100% then the cell displays *** Negative values need to be shown in
(%) rather than prefixed -

The following works with the exception that it will not display
negative values as (%)

[>1]"***";[<-1]"***";0.0%;-

Please can anybody come up with the right syntax?

I need to avoid using IF statements in the formulas

Regards

Michael
Andrea Jones - 28 May 2008 11:48 GMT
Try

[=1]0%;[<0](0.0%);"***"

Andrea Jones
www.stratatraining.co.uk
www.wrekinpublishing.com

> Hi All,
>
[quoted text clipped - 14 lines]
>
> Michael
Dave Peterson - 28 May 2008 12:38 GMT
If Andrea's response doesn't help, you may want to rephrase your question.

If the result > 100% or < 100%, show asterisks looks like you only want to see
the percentage at 100%--everything else shows asterisks.

> Hi All,
>
[quoted text clipped - 14 lines]
>
> Michael

Signature

Dave Peterson

michael.beckinsale - 28 May 2008 13:06 GMT
Hi All,

Sorry for the confusion.

This is what l mean:

0 to 1                         Cell displays %   ie   0% to 100%
>1                              Cell displays            ***
0 to -1                        Cell displays %   ie   (0%) to (100%)
< -1 lets say (126%)    Cell displays            ***

Andrea, your example put me on the right track but l still cant quite
get it right!

Hope you & Dave can help me get it sorted.

Regards

Michael
Marcelo - 28 May 2008 13:36 GMT
IF(OR((A1<-1),(A1>1)),REPT("*",3),A1)

replace A1 for your fuction if it is need and format the cell as %

hth
Signature

regards from Brazil
Thanks in advance for your feedback.
Marcelo

> Hi All,
>
[quoted text clipped - 15 lines]
>
> Michael
Dave Peterson - 28 May 2008 14:23 GMT
I don't think you can use this many parts in a custom format.

You could use another cell containing a formula -- like Marcelo suggested.

Or you could use a worksheet event that changes the formatting.

If you want to try...

Right click on the worksheet tab that should have this behavior.  Select view
code and paste this into the code window that just opened:

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
   'one cell at a time
   If Target.Cells.Count > 1 Then
       Exit Sub
   End If

   'only look at A2:A10
   If Intersect(Target, Me.Range("A2:A10")) Is Nothing Then
       Exit Sub
   End If

   If IsNumeric(Target.Value) = False Then
       Target.NumberFormat = "General"
   Else
       '< -1      Cell displays ***
       '0 to -1   Cell displays (#0%)
       '0 to 1    Cell displays #0%
       '>1        Cell displays ***
       Select Case Target.Value
           Case Is < -1
               Target.NumberFormat = ";""***"";;"
           Case Is < 0
               Target.NumberFormat = ";(#0%);;"
           Case Is < 1
               Target.NumberFormat = "#0%"
           Case Else
               Target.NumberFormat = """***"";;;"
       End Select
   End If

End Sub
I only looked at the range A2:A10.  Change that to what you need.

> Hi All,
>
[quoted text clipped - 15 lines]
>
> Michael

Signature

Dave Peterson

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.