Results 1 to 5 of 5
  1. #1
    samcase2 is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Jan 2015
    Posts
    2

    Separate Sets of Consecutive Numbers

    Hi there!

    I am working with a set of numbers all under the same ID in a table. Based on the ID number, these values all appear (as a list) on a report I created; however, since there are so many, I want to simply put a minimum and a maximum. The problem is, the numbers fall in consecutive sets, and I don't want the min and max to include the skipped values. So, for example, if there are a total of 30 numbers, they may fall something like 1-10, then 25-30, then 40-50, then 75-80. I'm looking for a way to show a minimum and a maximum for each consecutive set, like I just did, preferrably using a function or operator of some sort on the report and not modifying a the original data table. Any help?

    Thanks!!

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,644
    How many sets, how high does this numbering go?

    Create a group section in report with calc (or do the calc in query to create a field for grouping).

    Switch([fieldname]<11, "1-10", [fieldname] BETWEEN 25 AND 30, "25-30", [fieldname] BETWEEN 40 AND 50, "40-50", [fieldname] BETWEEN 75 AND 80, "75-80", [fieldname]>80, ">80")

    Now expressions in textboxes in group footer: Min([fieldname]), Max([fieldname])

    What about values between 10 and 25, 30 and 40, 50 and 75?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    samcase2 is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Jan 2015
    Posts
    2
    That would work, except I have hundreds of number sets, and the values range anywhere from 10635 to 31783. There is no consistency in how many numbers are in each consecutive group, and there is no limit how how many consecutive groups there could be for each ID. Is there a way to create group sections like you said, just with the calculation or criteria being "consecutive numbers only", so that each group section contains only consecutive numbers?

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,644
    This reminds me of 'natural breaks' data classification in ArcGIS mapping software. If it can be done within a query statement, it's beyond my knowledge and abilities. http://support.esri.com/en/knowledge...classification
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Well...... not knowing what your table or report looks like and not having what the results should look like, I threw together an example of a brute force method using VBA. Don't know if it will help, but maybe it will give you some ideas...

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

Similar Threads

  1. How to separate names into 2-separate fields
    By djclntn in forum Queries
    Replies: 4
    Last Post: 09-18-2014, 02:34 PM
  2. Replies: 5
    Last Post: 07-18-2014, 02:04 AM
  3. Group Consecutive Numbers in a Range
    By ChiSoxFan in forum Queries
    Replies: 1
    Last Post: 03-20-2014, 04:28 PM
  4. Replies: 21
    Last Post: 01-21-2014, 05:04 PM
  5. Consecutive ID numbers
    By jdvd in forum Database Design
    Replies: 2
    Last Post: 12-11-2011, 06:48 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