+ Reply to Thread
Results 1 to 2 of 2

counting actual and displayed values

  1. #1
    Registered User
    Join Date
    05-17-2006
    Posts
    1

    counting actual and displayed values

    Hi guys,
    I have a sheet with the following values, and certain cells are formatted differently.

    0 - displays as 0
    0 - displays as 0.0
    0 - displays as 0.00
    0.0043 - displays as 0.00
    0.0043 - displays as 0.0
    0.0043 - displays as 0.0043
    1 - displays as 1
    -0.1 - displays as -0.1

    I realize that no matter how a number is formatted, excel retains the underlying value. I want the formatted value though. For this list of numbers, I want to count the cells where the underlying value is 0, and count the cells where the formatted value is 0, via a macro.
    So in this example, there are 3 real 0s, and 5 formatted 0s.
    I don't really want to convert to text or anything, I tried rounding as well but can't find a good solution. c.value and c.formula both look at the underlying value. Is there something I can use in a macro to get the displayed value, rather than the underlying value? THanks!

  2. #2
    Ardus Petus
    Guest

    Re: counting actual and displayed values

    You can test Range("A1").Text for formatted text, and .Value for underlying
    value.

    HTH
    --
    AP

    "lxrhee" <[email protected]> a écrit dans
    le message de news: [email protected]...
    >
    > Hi guys,
    > I have a sheet with the following values, and certain cells are
    > formatted differently.
    >
    > 0 - displays as 0
    > 0 - displays as 0.0
    > 0 - displays as 0.00
    > 0.0043 - displays as 0.00
    > 0.0043 - displays as 0.0
    > 0.0043 - displays as 0.0043
    > 1 - displays as 1
    > -0.1 - displays as -0.1
    >
    > I realize that no matter how a number is formatted, excel retains the
    > underlying value. I want the formatted value though. For this list of
    > numbers, I want to count the cells where the underlying value is 0, and
    > count the cells where the formatted value is 0, via a macro.
    > So in this example, there are 3 real 0s, and 5 formatted 0s.
    > I don't really want to convert to text or anything, I tried rounding as
    > well but can't find a good solution. c.value and c.formula both look at
    > the underlying value. Is there something I can use in a macro to get
    > the displayed value, rather than the underlying value? THanks!
    >
    >
    > --
    > lxrhee
    > ------------------------------------------------------------------------
    > lxrhee's Profile:
    > http://www.excelforum.com/member.php...o&userid=34523
    > View this thread: http://www.excelforum.com/showthread...hreadid=542865
    >




+ 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