+ Reply to Thread
Results 1 to 6 of 6

Conditional format numbers

Hybrid View

  1. #1
    PiPPo
    Guest

    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


  2. #2
    Anne Troy
    Guest

    Re: 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/...soft_excel.htm

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

    "PiPPo" <[email protected]> wrote in message
    news:[email protected]...
    > 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
    >




  3. #3
    PiPPo
    Guest

    Re: 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


  4. #4
    Biff
    Guest

    Re: 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" <[email protected]> wrote in message
    news:[email protected]...
    > 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
    >




  5. #5
    PiPPo
    Guest

    Re: 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.


  6. #6
    Rowan Drummond
    Guest

    Re: 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.
    >


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1