Consulting

Results 1 to 5 of 5

Thread: Solved: Find the rows count in in a column where cell value >0

  1. #1
    VBAX Regular darweesh8's Avatar
    Joined
    Feb 2012
    Location
    Amman-Jordan
    Posts
    14
    Location

    Solved: Find the rows count in in a column where cell value >0

    Experts,

    I need a code to find the rows count in in a column where cell value >0

    example: if column likbelow
    20
    15
    10
    5
    4
    1
    0
    0
    0


    then the row count is 9 but i need it to be 6 (zero to not counted as used cell)

    Please help.

  2. #2
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,876
    try:
    =COUNTIF(A2:A6,">0")
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

  3. #3
    Site Admin
    Jedi Master
    VBAX Guru Jacob Hilderbrand's Avatar
    Joined
    Jun 2004
    Location
    Roseville, CA
    Posts
    3,712
    Location
    x = Application.WorksheetFunction.CountIf(Range("A:A"), ">0")

    Or

    x = Evaluate("=COUNTIF(A:A," & """" & ">0" & """" & ")")

    For the evaluate to work the sheet you are analyzing must be active. For the WorksheetFunction you can put the sheet name before the range if the sheet is not the active sheet.

    Thanks

    Jake

  4. #4
    VBAX Regular darweesh8's Avatar
    Joined
    Feb 2012
    Location
    Amman-Jordan
    Posts
    14
    Location
    DRJ,

    A million thanks, that was great.

    How can I mark this issue as solved?

  5. #5
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    At the head of the threads there is a 'Thread Tools' dropdown, the solved option is in there.

    I worked in Jordan a fair bit last year, are you living in Amman.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Posting Permissions

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