+ Reply to Thread
Results 1 to 3 of 3

Thread: Trouble with COUNTIF non zero values

  1. #1
    Registered User
    Join Date
    11-01-2010
    Location
    Burlington, MA
    MS-Off Ver
    Excel 2007
    Posts
    11

    Trouble with COUNTIF non zero values

    Having trouble with a count if statement. The file is linked to a live database. I have subtotals and counts for each change in column C. What I currently have works fine has a regular count, but I would like to count only non zero cells in column D but keep getting compilation errors. Here is what works as a regular count...

    wssheet.Cells(currRow + 2, 4) = "=Counta(D" + Format(startRow) + ":D" + Format(currRow) + ")"
    and here is an example of my attempt:

    wssheet.Cells(currRow + 2, 4) = "=CountIF(D" + Format(startRow) + ":D" + Format(currRow) + ",’>0’)"

  2. #2
    Forum Guru sweep's Avatar
    Join Date
    04-03-2007
    Location
    Location: Location:
    MS-Off Ver
    3.0
    Posts
    2,472

    Re: Trouble with COUNTIF non zero values

    Hi,

    Would this do what you require?

     
    wssheet.Cells(currRow + 2, 4).Formula = "=COUNTIF(D" & Format(startRow) & ":D" & Format(currRow) &","">0"")"
    Please disregard anything in the above post. It may well have been edited without my consent, as has been the case with several posts and threads recently.

  3. #3
    Registered User
    Join Date
    11-01-2010
    Location
    Burlington, MA
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Trouble with COUNTIF non zero values

    Perfect. Thank you for such a quick response.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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.2.0