+ Reply to Thread
Results 1 to 5 of 5

Using countif and offset for a named range

  1. #1
    Registered User
    Join Date
    02-21-2012
    Location
    Wilmington, DE
    MS-Off Ver
    Excel 2010
    Posts
    2

    Using countif and offset for a named range

    Hi,

    I have a spreadsheet (attached) that contains id#'s, activity date, create date, datediff and employee nam.

    I want to count
    • the number of invoices for each employee
    • the number of ids created before the activity date,
    • the number of ids creaetd after the activity date,

    without having to enter the range for each employee.

    I am able to do this using countifs (=COUNTIF(range,"enployee name" and =COUNTIF(range,">"&0).

    Since the employees and number of activities differ each time the report is run, is there a way automate this or do this with dynamic ranges, countifs and offsets?

    Thanks!
    Attached Files Attached Files
    Last edited by NBVC; 02-22-2012 at 03:54 PM.

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Using countif and offset for a named range

    You can define the range like:

    MyRange: =Sheet1!$D$1:INDEX(Sheet1!$D:$D,MATCH(9.9999E+307,Sheet1!$D:$D))

    that applies for the ranges with numeric entries.

    MyRange2: =Sheet1!$E$1:INDEX(Sheet1!$E:$E,MATCH(REPT("z",255),Sheet1!$E:$E))

    that applies for ranges with text entries
    Last edited by NBVC; 02-22-2012 at 12:51 PM.
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Using countif and offset for a named range

    Hi Smithwa,

    Welcome to the forum.

    See the attached file where I have used the defined name in your formulas. Let me know in case of any questions. Thanks.


    Regards,
    DILIPandey

    <click on below 'star' if this helps>
    Attached Files Attached Files
    DILIPandey, Excel rMVP
    +919810929744 (India), +971528225509 (Dubai), dilipandey@gmail.com

  4. #4
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Using countif and offset for a named range

    Hi set up two dynamic range names
    Employee: =OFFSET(Sheet1!$E$1,0,0,COUNTA(Sheet1!$E:$E),1)
    DateDiff: =OFFSET(Sheet1!$D$1,0,0,COUNTA(Sheet1!$E:$E),1)

    Now in
    H2: =COUNTIF(Employee,G2)
    I2: =COUNTIFS(DateDiff,">="&0,Employee,G2)
    J2: =COUNTIFS(DateDiff,"<"&0,Employee,G2)

    and copy H2:J2 down

    Regards
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  5. #5
    Registered User
    Join Date
    02-21-2012
    Location
    Wilmington, DE
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Using countif and offset for a named range

    Thanks everyone for your rapid responses. The solutions that utilize the OFFSET function appear to work the best for my situation.

    Much appreciated :D
    -SmithWA

+ 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.6.0 RC 1