cancel
Showing results for 
Search instead for 
Did you mean: 

Gap in consecutive numbers

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi Carl, Thanks for your help so far. Unfortunately I over looked that fact that in some cases the registration number has ends with a forward slash and two numbers which stand for the year, such as 023655/09. Another factor I'll need to consider and may need assistance with also is that the number of digits that make up the left hand portion of the registration number has not always contained the same number of characters.

Thanks

Jorge

Former Member
0 Kudos

Hi Carl

I have worked how overcome my list peculiarities and you formula has worked wonderfully.

Many thanks

Jorge

Answers (1)

Answers (1)

Former Member
0 Kudos

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.