+ Reply to Thread
Results 1 to 3 of 3

Countif with activecell.row variable for range?

  1. #1
    Forum Contributor JP Romano's Avatar
    Join Date
    10-09-2008
    Location
    Princeton, NJ
    MS-Off Ver
    2010
    Posts
    500

    Countif with activecell.row variable for range?

    Hi... I'm trying to loop through some data, adding a formula for a COUNTIF function, but am having trouble with the syntax. Can one of you lend a hand?

    The sheet name that the formula goes into is "NRSS-1"
    The sheet name which has the values to be counted is "E3"
    The column in "E3" which has the values to be counted is B
    When entered manually, the formula I'm using looks like this:
    =COUNTIF('E3'!B:B,A2)
    However, I want to replace the "A2" with "activecell.row"

    Any guidance would be appreciated!
    Last edited by JP Romano; 01-24-2011 at 11:46 AM. Reason: Solved

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Countif with activecell.row variable for range?

    Change you formula to:

    =COUNTIF('E3'!B:B, MyVal)

    Then put this code into the NRSS-1 sheet module where you want MyVal to resolve to the activecell.row in column A. As you select a new cell, the MyVal target address will change causing the formula to reassess.
    Please Login or Register  to view this content.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Contributor JP Romano's Avatar
    Join Date
    10-09-2008
    Location
    Princeton, NJ
    MS-Off Ver
    2010
    Posts
    500

    Re: Countif with activecell.row variable for range?

    Perfect...thanks a million!

+ 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