+ Reply to Thread
Results 1 to 5 of 5

Macro that counts cells with a specific value

  1. #1
    Registered User
    Join Date
    11-04-2003
    Location
    HELSINKI
    Posts
    8

    Macro that counts cells with a specific value

    Hello,

    I need a macro that counts the cells in a column that contain values above 0.

    The outcome of this count should then appear afterwards on certain cell.

    Ideas are very welcome!

    Thanks in advance!

    Robby
    Robby

  2. #2
    Ron de Bruin
    Guest

    Re: Macro that counts cells with a specific value

    Try

    =COUNTIF(D1:D100,">0")

    --
    Regards Ron de Bruin
    http://www.rondebruin.nl


    "VILLABILLA" <[email protected]> wrote in message
    news:[email protected]...
    >
    > Hello,
    >
    > I need a macro that counts the cells in a column that contain values
    > above 0.
    >
    > The outcome of this count should then appear afterwards on certain
    > cell.
    >
    > Ideas are very welcome!
    >
    > Thanks in advance!
    >
    > Robby
    >
    >
    > --
    > VILLABILLA
    >
    >
    > ------------------------------------------------------------------------
    > VILLABILLA's Profile: http://www.excelforum.com/member.php...fo&userid=2242
    > View this thread: http://www.excelforum.com/showthread...hreadid=491406
    >




  3. #3
    Ron de Bruin
    Guest

    Re: Macro that counts cells with a specific value

    Oops

    Range("E1").Value = Application.CountIf(Range("D:D"), ">0")


    --
    Regards Ron de Bruin
    http://www.rondebruin.nl


    "Ron de Bruin" <[email protected]> wrote in message news:e9DAKJy%[email protected]...
    > Try
    >
    > =COUNTIF(D1:D100,">0")
    >
    > --
    > Regards Ron de Bruin
    > http://www.rondebruin.nl
    >
    >
    > "VILLABILLA" <[email protected]> wrote in message
    > news:[email protected]...
    >>
    >> Hello,
    >>
    >> I need a macro that counts the cells in a column that contain values
    >> above 0.
    >>
    >> The outcome of this count should then appear afterwards on certain
    >> cell.
    >>
    >> Ideas are very welcome!
    >>
    >> Thanks in advance!
    >>
    >> Robby
    >>
    >>
    >> --
    >> VILLABILLA
    >>
    >>
    >> ------------------------------------------------------------------------
    >> VILLABILLA's Profile: http://www.excelforum.com/member.php...fo&userid=2242
    >> View this thread: http://www.excelforum.com/showthread...hreadid=491406
    >>

    >
    >




  4. #4
    Registered User
    Join Date
    11-04-2003
    Location
    HELSINKI
    Posts
    8
    Thanks a lot for the proposed solution, it works.

    However, what I overlooked is the fact that some of the numbers in column that should be counted have the text format. Any way to count the cells in a column that have a value(although text) except the blank cells?

    Thanks very much!

  5. #5
    Ron de Bruin
    Guest

    Re: Macro that counts cells with a specific value

    Application.CountIf(Range("D:D"), "<>0")
    This will count all cells except the cells with 0

    If you want to count all cells that are not blank use
    MsgBox Application.CountA(Range("D:D"))

    --
    Regards Ron de Bruin
    http://www.rondebruin.nl


    "VILLABILLA" <[email protected]> wrote in message
    news:[email protected]...
    >
    > Thanks a lot for the proposed solution, it works.
    >
    > However, what I overlooked is the fact that some of the numbers in
    > column that should be counted have the text format. Any way to count
    > the cells in a column that have a value(although text) except the blank
    > cells?
    >
    > Thanks very much!
    >
    >
    > --
    > VILLABILLA
    >
    >
    > ------------------------------------------------------------------------
    > VILLABILLA's Profile: http://www.excelforum.com/member.php...fo&userid=2242
    > View this thread: http://www.excelforum.com/showthread...hreadid=491406
    >




+ 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