+ Reply to Thread
Results 1 to 4 of 4

CountIF and changing ranges

  1. #1
    Registered User
    Join Date
    10-01-2005
    Posts
    2

    CountIF and changing ranges

    Hi all,

    I'm working on a function that tells me how many cells there are with "Paid" in it. The problem being, they the range will change depending on what the date is:

    I reckon i'm pretty close with this:

    =COUNTIF(ADDRESS(2,C35,4)&":P2",$C$20)

    Where:
    C20 = Paid
    C35 = 6 (Don't worry about why this is 6 - Long story, but it changes depending on the current date)

    If I use the forumla bar in excel it tells me that:
    ADDRESS(2,C35,4)&":P2" = "F2:P2" Which is the problem
    Because it's giving me "F2:P2" (with the quotes) instead of just F2:P2. I'm 99% sure this is causing it to error and not give me a result - because it's seeing the range as text. I don't know what else to do, can anyone suggest anything?

    Thanks in advance.

  2. #2
    Biff
    Guest

    Re: CountIF and changing ranges

    Hi!

    Try this:

    =COUNTIF(INDIRECT(ADDRESS(2,C35)):P2,$C$20)

    Biff

    "dark" <[email protected]> wrote in message
    news:[email protected]...
    >
    > Hi all,
    >
    > I'm working on a function that tells me how many cells there are with
    > "Paid" in it. The problem being, they the range will change depending
    > on what the date is:
    >
    > I reckon i'm pretty close with this:
    >
    > =COUNTIF(ADDRESS(2,C35,4)&":P2",$C$20)
    >
    > Where:
    > C20 = Paid
    > C35 = 6 (Don't worry about why this is 6 - Long story, but it changes
    > depending on the current date)
    >
    > If I use the forumla bar in excel it tells me that:
    > ADDRESS(2,C35,4)&":P2" = "F2:P2" Which is the problem
    > Because it's giving me "F2:P2" (with the quotes) instead of just F2:P2.
    > I'm 99% sure this is causing it to error and not give me a result -
    > because it's seeing the range as text. I don't know what else to do,
    > can anyone suggest anything?
    >
    > Thanks in advance.
    >
    >
    > --
    > dark
    > ------------------------------------------------------------------------
    > dark's Profile:
    > http://www.excelforum.com/member.php...o&userid=27723
    > View this thread: http://www.excelforum.com/showthread...hreadid=472378
    >




  3. #3
    Biff
    Guest

    Re: CountIF and changing ranges

    Another way:

    =COUNTIF(OFFSET(A2,,C35-1):P2,C20)

    Biff

    "Biff" <[email protected]> wrote in message
    news:[email protected]...
    > Hi!
    >
    > Try this:
    >
    > =COUNTIF(INDIRECT(ADDRESS(2,C35)):P2,$C$20)
    >
    > Biff
    >
    > "dark" <[email protected]> wrote in message
    > news:[email protected]...
    >>
    >> Hi all,
    >>
    >> I'm working on a function that tells me how many cells there are with
    >> "Paid" in it. The problem being, they the range will change depending
    >> on what the date is:
    >>
    >> I reckon i'm pretty close with this:
    >>
    >> =COUNTIF(ADDRESS(2,C35,4)&":P2",$C$20)
    >>
    >> Where:
    >> C20 = Paid
    >> C35 = 6 (Don't worry about why this is 6 - Long story, but it changes
    >> depending on the current date)
    >>
    >> If I use the forumla bar in excel it tells me that:
    >> ADDRESS(2,C35,4)&":P2" = "F2:P2" Which is the problem
    >> Because it's giving me "F2:P2" (with the quotes) instead of just F2:P2.
    >> I'm 99% sure this is causing it to error and not give me a result -
    >> because it's seeing the range as text. I don't know what else to do,
    >> can anyone suggest anything?
    >>
    >> Thanks in advance.
    >>
    >>
    >> --
    >> dark
    >> ------------------------------------------------------------------------
    >> dark's Profile:
    >> http://www.excelforum.com/member.php...o&userid=27723
    >> View this thread:
    >> http://www.excelforum.com/showthread...hreadid=472378
    >>

    >
    >




  4. #4
    Registered User
    Join Date
    10-01-2005
    Posts
    2
    Ah thanks heaps!
    I don't understand the second way, but I do the first. That makes sense, I thought it would be something that simple. Thanks mate.

    Now my formula is complete! :P
    =COUNTIF(INDIRECT(ADDRESS(2,MATCH(NOW()+CHOOSE(WEEKDAY(NOW()),5,4,3,2,1,7,6),$1:$1))):IV2,$B$20)*3

+ 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