ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Conditional format numbers (https://www.excelbanter.com/excel-worksheet-functions/50945-conditional-format-numbers.html)

PiPPo

Conditional format numbers
 
Hi,
This is my problem. I would like to format a number in B1 on the basis
of a certain condition in A1.
I read in another post that I need a macro to conditional format
numbers. Is that correct? Where can I find such macro? If this is not
the case, can anyone help me with my problem?

Thank you,

Pippo


Anne Troy

Conditional format numbers
 
You don't necessarily need a macro, unless you want more than 3 conditional
formats. Likely, you just need a formula CF:
http://www.officearticles.com/excel/...ft_ excel.htm

If you need the macro after all:
http://vbaexpress.com/kb/getarticle.php?kb_id=90
************
Anne Troy
www.OfficeArticles.com

"PiPPo" wrote in message
oups.com...
Hi,
This is my problem. I would like to format a number in B1 on the basis
of a certain condition in A1.
I read in another post that I need a macro to conditional format
numbers. Is that correct? Where can I find such macro? If this is not
the case, can anyone help me with my problem?

Thank you,

Pippo




PiPPo

Conditional format numbers
 
Well,

What I need is to format the value in a cell on the basis of a
condition in another cell. The number I want to format has to assume
one of the three following formats: X%, X or Xd, where X is a not
bounded number of figures . In other words, the value may be a
percentage, an integer number or a special format Xd.

Dos anyone have an idea?

Thank you very much


Biff

Conditional format numbers
 
Perhaps if you gave us some specific examples.

It would also help if you told us what the condition is!!!!!!!!!!!

Biff

"PiPPo" wrote in message
oups.com...
Well,

What I need is to format the value in a cell on the basis of a
condition in another cell. The number I want to format has to assume
one of the three following formats: X%, X or Xd, where X is a not
bounded number of figures . In other words, the value may be a
percentage, an integer number or a special format Xd.

Dos anyone have an idea?

Thank you very much




PiPPo

Conditional format numbers
 
Ok, I apologize for not being clear.

In A1 I want to put one of the following three strings of text:
"Inventory", "Inventory - % of COGS", "Inventory - DIO". Cell B1 has to
be formatted as an integer number if "Inventory" is chosen, a
percentage number if "Inventory - % of COGS" is chosen or as a special
format Xd (where d stands for days) when the third condition is
selected.

Thank you again.


Rowan Drummond

Conditional format numbers
 
You cannot use Conditional formatting to change number formats so you
would need to use a worksheet change event something like this:

Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo ErrorHandler
Application.EnableEvents = False
If Target.count = 1 And Target.Address = "$A$1" Then
Select Case Target.Value
Case "Inventory"
Range("B1").NumberFormat = "#,##0"
Case "Inventory - % of COGS"
Range("B1").NumberFormat = "0.00%"
Case "Inventory - DIO"
Range("B1").NumberFormat = "Xd"
End Select
End If
ErrorHandler:
Application.EnableEvents = True
End Sub

This is worksheet event code. Right click the sheet tab, select View
Code and Paste the code in there.

Hope this helps
Rowan

PiPPo wrote:
Ok, I apologize for not being clear.

In A1 I want to put one of the following three strings of text:
"Inventory", "Inventory - % of COGS", "Inventory - DIO". Cell B1 has to
be formatted as an integer number if "Inventory" is chosen, a
percentage number if "Inventory - % of COGS" is chosen or as a special
format Xd (where d stands for days) when the third condition is
selected.

Thank you again.



All times are GMT +1. The time now is 07:22 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com