+ Reply to Thread
Results 1 to 13 of 13

A list of Consecutive Integers, can I search for missing integers

  1. #1
    Harlan Grove
    Guest

    Re: A list of Consecutive Integers, can I search for missing integers

    CM wrote...
    >If I have a column of sorted consecutive Integers, can I search that column
    >and find cells that might be missing a consecutive Integer? We have a list
    >of customer numbers and if we don't have a number in the sorted sequential
    >order we want to be able to know that. Any help?


    If you have a column of sorted integers in a range named LST in which
    all the integers should be consecutive, your first test should be
    whether there are any duplicates. That can be done using

    =SUMPRODUCT((LST<>"")/(COUNTIF(LST,LST)+(LST="")))=COUNT(LST)

    If this returns TRUE, then all numbers in the list are distinct.

    Next, check that they're all integers.

    =SUMPRODUCT(--(MOD(LST,1)=0))=COUNT(LST)

    Once these two tests have been passed, it's simple to check if they're
    consecutive.

    =MAX(LST)-MIN(LST)=COUNT(LST)-1

    If they're not, then the index within LST of the k_th nonconsecutive
    integer is given by the array formula

    =SMALL(IF(OFFSET(LST,0,0,COUNT(LST)-1,1)<OFFSET(LST,1,0,COUNT(LST)-1,1)-1,
    ROW(INDIRECT("2:"&ROWS(LST)))),k)


  2. #2
    Barb Reinhardt
    Guest

    RE: A list of Consecutive Integers, can I search for missing integers

    Why not insert a helper column and calculate the difference between the two
    values.

    "CM" wrote:

    > If I have a column of sorted consecutive Integers, can I search that column
    > and find cells that might be missing a consecutive Integer? We have a list
    > of customer numbers and if we don't have a number in the sorted sequential
    > order we want to be able to know that. Any help?


  3. #3
    Duke Carey
    Guest

    RE: A list of Consecutive Integers, can I search for missing integers

    This works with a starting value of 1000 in cell A2, so that the integer
    MINUS 998 = the Row#, and returns the row of the first nonconsecutive integer:

    =MAX(--(A2:A28-998=ROW(A2:A28))*ROW(A2:A28))

    "CM" wrote:

    > If I have a column of sorted consecutive Integers, can I search that column
    > and find cells that might be missing a consecutive Integer? We have a list
    > of customer numbers and if we don't have a number in the sorted sequential
    > order we want to be able to know that. Any help?


  4. #4
    Duke Carey
    Guest

    RE: A list of Consecutive Integers, can I search for missing integ

    And it needs to be entered as an array formula with

    Ctrl-Shift-Enter


    "Duke Carey" wrote:

    > This works with a starting value of 1000 in cell A2, so that the integer
    > MINUS 998 = the Row#, and returns the row of the first nonconsecutive integer:
    >
    > =MAX(--(A2:A28-998=ROW(A2:A28))*ROW(A2:A28))
    >
    > "CM" wrote:
    >
    > > If I have a column of sorted consecutive Integers, can I search that column
    > > and find cells that might be missing a consecutive Integer? We have a list
    > > of customer numbers and if we don't have a number in the sorted sequential
    > > order we want to be able to know that. Any help?


  5. #5
    Harlan Grove
    Guest

    Re: A list of Consecutive Integers, can I search for missing integers

    CM wrote...
    >If I have a column of sorted consecutive Integers, can I search that column
    >and find cells that might be missing a consecutive Integer? We have a list
    >of customer numbers and if we don't have a number in the sorted sequential
    >order we want to be able to know that. Any help?


    If you have a column of sorted integers in a range named LST in which
    all the integers should be consecutive, your first test should be
    whether there are any duplicates. That can be done using

    =SUMPRODUCT((LST<>"")/(COUNTIF(LST,LST)+(LST="")))=COUNT(LST)

    If this returns TRUE, then all numbers in the list are distinct.

    Next, check that they're all integers.

    =SUMPRODUCT(--(MOD(LST,1)=0))=COUNT(LST)

    Once these two tests have been passed, it's simple to check if they're
    consecutive.

    =MAX(LST)-MIN(LST)=COUNT(LST)-1

    If they're not, then the index within LST of the k_th nonconsecutive
    integer is given by the array formula

    =SMALL(IF(OFFSET(LST,0,0,COUNT(LST)-1,1)<OFFSET(LST,1,0,COUNT(LST)-1,1)-1,
    ROW(INDIRECT("2:"&ROWS(LST)))),k)


  6. #6
    Barb Reinhardt
    Guest

    RE: A list of Consecutive Integers, can I search for missing integers

    Why not insert a helper column and calculate the difference between the two
    values.

    "CM" wrote:

    > If I have a column of sorted consecutive Integers, can I search that column
    > and find cells that might be missing a consecutive Integer? We have a list
    > of customer numbers and if we don't have a number in the sorted sequential
    > order we want to be able to know that. Any help?


  7. #7
    Duke Carey
    Guest

    RE: A list of Consecutive Integers, can I search for missing integers

    This works with a starting value of 1000 in cell A2, so that the integer
    MINUS 998 = the Row#, and returns the row of the first nonconsecutive integer:

    =MAX(--(A2:A28-998=ROW(A2:A28))*ROW(A2:A28))

    "CM" wrote:

    > If I have a column of sorted consecutive Integers, can I search that column
    > and find cells that might be missing a consecutive Integer? We have a list
    > of customer numbers and if we don't have a number in the sorted sequential
    > order we want to be able to know that. Any help?


  8. #8
    Duke Carey
    Guest

    RE: A list of Consecutive Integers, can I search for missing integ

    And it needs to be entered as an array formula with

    Ctrl-Shift-Enter


    "Duke Carey" wrote:

    > This works with a starting value of 1000 in cell A2, so that the integer
    > MINUS 998 = the Row#, and returns the row of the first nonconsecutive integer:
    >
    > =MAX(--(A2:A28-998=ROW(A2:A28))*ROW(A2:A28))
    >
    > "CM" wrote:
    >
    > > If I have a column of sorted consecutive Integers, can I search that column
    > > and find cells that might be missing a consecutive Integer? We have a list
    > > of customer numbers and if we don't have a number in the sorted sequential
    > > order we want to be able to know that. Any help?


  9. #9
    CM
    Guest

    A list of Consecutive Integers, can I search for missing integers

    If I have a column of sorted consecutive Integers, can I search that column
    and find cells that might be missing a consecutive Integer? We have a list
    of customer numbers and if we don't have a number in the sorted sequential
    order we want to be able to know that. Any help?

  10. #10
    Harlan Grove
    Guest

    Re: A list of Consecutive Integers, can I search for missing integers

    CM wrote...
    >If I have a column of sorted consecutive Integers, can I search that column
    >and find cells that might be missing a consecutive Integer? We have a list
    >of customer numbers and if we don't have a number in the sorted sequential
    >order we want to be able to know that. Any help?


    If you have a column of sorted integers in a range named LST in which
    all the integers should be consecutive, your first test should be
    whether there are any duplicates. That can be done using

    =SUMPRODUCT((LST<>"")/(COUNTIF(LST,LST)+(LST="")))=COUNT(LST)

    If this returns TRUE, then all numbers in the list are distinct.

    Next, check that they're all integers.

    =SUMPRODUCT(--(MOD(LST,1)=0))=COUNT(LST)

    Once these two tests have been passed, it's simple to check if they're
    consecutive.

    =MAX(LST)-MIN(LST)=COUNT(LST)-1

    If they're not, then the index within LST of the k_th nonconsecutive
    integer is given by the array formula

    =SMALL(IF(OFFSET(LST,0,0,COUNT(LST)-1,1)<OFFSET(LST,1,0,COUNT(LST)-1,1)-1,
    ROW(INDIRECT("2:"&ROWS(LST)))),k)


  11. #11
    Barb Reinhardt
    Guest

    RE: A list of Consecutive Integers, can I search for missing integers

    Why not insert a helper column and calculate the difference between the two
    values.

    "CM" wrote:

    > If I have a column of sorted consecutive Integers, can I search that column
    > and find cells that might be missing a consecutive Integer? We have a list
    > of customer numbers and if we don't have a number in the sorted sequential
    > order we want to be able to know that. Any help?


  12. #12
    Duke Carey
    Guest

    RE: A list of Consecutive Integers, can I search for missing integers

    This works with a starting value of 1000 in cell A2, so that the integer
    MINUS 998 = the Row#, and returns the row of the first nonconsecutive integer:

    =MAX(--(A2:A28-998=ROW(A2:A28))*ROW(A2:A28))

    "CM" wrote:

    > If I have a column of sorted consecutive Integers, can I search that column
    > and find cells that might be missing a consecutive Integer? We have a list
    > of customer numbers and if we don't have a number in the sorted sequential
    > order we want to be able to know that. Any help?


  13. #13
    Duke Carey
    Guest

    RE: A list of Consecutive Integers, can I search for missing integ

    And it needs to be entered as an array formula with

    Ctrl-Shift-Enter


    "Duke Carey" wrote:

    > This works with a starting value of 1000 in cell A2, so that the integer
    > MINUS 998 = the Row#, and returns the row of the first nonconsecutive integer:
    >
    > =MAX(--(A2:A28-998=ROW(A2:A28))*ROW(A2:A28))
    >
    > "CM" wrote:
    >
    > > If I have a column of sorted consecutive Integers, can I search that column
    > > and find cells that might be missing a consecutive Integer? We have a list
    > > of customer numbers and if we don't have a number in the sorted sequential
    > > order we want to be able to know that. Any help?


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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