Results 1 to 5 of 5
  1. #1
    Dean1792 is offline Novice
    Windows 10 Access 2013 32bit
    Join Date
    Apr 2020
    Posts
    2

    CountIIF between a range (not a date)

    Hi, sorry new to Access apologies if there is a simple answer. moving an Excel file to Access

    The requirement:
    A record is added to the table with a DateRaised on the form. When that record is closed a date is added to the CloseOutDate. An Age field is calculated.

    I want a query that adds all the records between 1-7 Days, 8-14 Days, 15-21 Days, 22-29 Days, 30-59 Days, 60+ Days.

    In Excel I used the following
    Code:
    =COUNTIFS('Sheet 1'!V2:V244,">0", 'Sheet 1'!V2:V244,"<8")
    In Access I've tried:
    Code:
    1-7 Days: Sum(IIf([Age] Between "0" And "7",1,0))
    Thanks in advanced

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    Q1, create a sum query , (turn 0n summation) , then make a Count(ID) where between date1 and date2 (per date)
    Q2, use Q1 to box your 'range' CountID between 1 and 7
    Q3, use Q1 to box your 'range' CountID between 8 and 14

    you can put them all together in a union query:
    select * from Q2
    union

    select * from Q3
    union
    select * from Q4

  3. #3
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    FYI, presuming age is a number, drop the quotes:

    Sum(IIf([Age] Between 0 And 7,1,0))
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  4. #4
    Dean1792 is offline Novice
    Windows 10 Access 2013 32bit
    Join Date
    Apr 2020
    Posts
    2
    I feel dumb... it was literally the quotes that was throwing it off. Thank you

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Glad you got it working.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 4
    Last Post: 11-20-2018, 11:57 PM
  2. Replies: 7
    Last Post: 09-02-2018, 04:39 PM
  3. Replies: 17
    Last Post: 07-31-2018, 01:23 PM
  4. Countiif date with criteria in textbox
    By RAJESHKUMAR R in forum Forms
    Replies: 3
    Last Post: 04-21-2018, 07:14 AM
  5. Replies: 3
    Last Post: 01-26-2016, 01:56 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums