+ Reply to Thread
Results 1 to 7 of 7

Countif and hidden rows.

  1. #1
    andyw
    Guest

    Countif and hidden rows.

    Hello,

    Can someone help alter this formula?

    At the moment the core part of it counts the cells which do not contain
    the value NA

    The trouble is the COUNTIF function counts the hidden cells as well.

    Any suggestions (I'm quite new to excel...)

    =COUNTIF(Sheet1!F14:F2126,"<>NA")


  2. #2
    Bob Phillips
    Guest

    Re: Countif and hidden rows.

    Hidden by what? If filtering you could try

    =SUMPRODUCT(SUBTOTAL(3,OFFSET($B$13,ROW($B$14:$B$2126)-ROW($B$1),,1))*(F14:F
    2126<>"NA"))

    where B is th filtered column


    --

    HTH

    RP
    (remove nothere from the email address if mailing direct)


    "andyw" <[email protected]> wrote in message
    news:[email protected]...
    > Hello,
    >
    > Can someone help alter this formula?
    >
    > At the moment the core part of it counts the cells which do not contain
    > the value NA
    >
    > The trouble is the COUNTIF function counts the hidden cells as well.
    >
    > Any suggestions (I'm quite new to excel...)
    >
    > =COUNTIF(Sheet1!F14:F2126,"<>NA")
    >




  3. #3
    Forum Contributor
    Join Date
    11-29-2005
    Posts
    142
    This seems to work:

    =SUBTOTAL(3,IF(SUMPRODUCT(--(F14:F2126<>"NA"))>0,F14:F2126))

  4. #4
    andyw
    Guest

    Re: Countif and hidden rows.


    No its not a filtered list, just a standard hidden row


  5. #5
    Forum Contributor
    Join Date
    11-29-2005
    Posts
    142
    What is the reason your rows are hidden,

    Perhaps that reasoning could be turned into a condition to apply to count statement.

    If there is no particular reason that can be converted to a function, then you may have to go the macro route.

  6. #6
    Bob Phillips
    Guest

    Re: Countif and hidden rows.

    Try this then.

    First add this UDF

    Function IsVisible(ByVal Target As Range)
    Dim oRow As Range
    Dim i As Long
    Dim ary()
    ReDim ary(1 To 1, 1 To Target.Rows.Count)
    i = 0
    For Each oRow In Target.Rows
    i = i + 1
    ary(1, i) = Not oRow.EntireRow.Hidden
    Next oRow
    IsVisible = ary
    End Function


    Then use this formula

    =SUM(TRANSPOSE(IsVisible(F14:F26))*(F14:F26<>"NA"))

    --

    HTH

    RP
    (remove nothere from the email address if mailing direct)


    "andyw" <[email protected]> wrote in message
    news:[email protected]...
    >
    > No its not a filtered list, just a standard hidden row
    >




  7. #7
    Bob Phillips
    Guest

    Re: Countif and hidden rows.

    Forgot to say, the formula is an array formula, so commit with
    Ctrl-Shift-Enter.

    --

    HTH

    RP
    (remove nothere from the email address if mailing direct)


    "andyw" <[email protected]> wrote in message
    news:[email protected]...
    >
    > No its not a filtered list, just a standard hidden row
    >




+ 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