Skip to Content
author's profile photo Former Member
Former Member

Gap in consecutive numbers

I have a list of registration numbers and wish to find out if any have not been used, that is are missing. Take the following example where the registration numbers are 123, 124, 125, 127 and 129. I need a formula that can identify 126 and 128 as the missing numbers.

Thanks

Jorge

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Feb 03, 2010 at 09:57 PM

    Sort by the registration number, then add this formula to your detail format (basic syntax):

    if {reg_num} - PreviousValue({reg_num}) > 1 then
      if {reg_num} - PreviousValue({reg_num})  = 2 then
        formula = cstr({reg_num} - 1, "0")
      else
        formula = cstr(PreviousValue({reg_num}) + 1, "0") + "-" + cstr({reg_num} - 1, "0")
      end if
    end if
    

    HTH,

    Carl

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 10, 2010 at 12:40 AM

    I've had another look at the report produced using the Carl's formula and noticed quite a significant number of numbers appearing were not infact missing. I hope someone can assist.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.