How to identify missing numbers sequence in Excel?

Let's say you have a long list of sequence numbers to mark items, such as check numbers in bank statements, normally we scrolling through and locate the missing sequence numbers manually. Sometimes this is quite arduous and time-consuming. You may think of tricky ways to deal with it. Yes, there are several easy ways to identify and locate missing numbers sequence in Excel 2007, Excel 2010, and Excel 2013 quickly and conveniently.

Identify missing numbers sequence with IF formula

Identify missing numbers sequence with an array formula

Identify missing numbers sequence with VBA code

Kutools for Excel: add 120 new features in Excel. Save one hour every day.
Classic Menu for Office: brings back classic menus to Office 2010 and 2013 (includes Office 365).
Office Tab: brings tabbed interface to Office as the use of web browser Chrome, Firefox and Internet Explorer.

We will show you the tutorials with an example as following screenshot shows:

doc-identify-missing-numbers1


arrow blue right bubble Identify missing numbers sequence with IF formula

Hot
Amazing! Using Tabs in Excel like Firefox, Chrome, Internet Explore 10!

As we kwon, most of sequence numbers are with fixed increment of 1, such as 1, 2, 3, …, N. Therefore, if you can identify the number is not less 1 than its following number, there is a missing number.

1. In a blank cell, enter the formula of =IF(A2-A1=1,"","Missing"), and press the Enter key. In this case, we enter the formula in Cell C1.

doc-identify-missing-numbers2

If there is no missing numbers, this formula will return nothing; if missing numbers exist, it will return the text of "Missing" in active cell.

2. Select the cell C1 and drag the fill handle over the range of cells that you want to contain this formula. Now it identifies the missing numbers with the text of "Missing" in corresponding cells of Column C. See the following screenshot:

doc-identify-missing-numbers3


arrow blue right bubble Identify missing numbers sequence with an array formula

Sometimes it requires not only identifying missing numbers sequence, but also listing missing numbers too. You can deal it with following steps:

1. in the adjacent cell, please enter the formula = SMALL(IF(ISNA(MATCH(ROW(A$1:A$30),A$1:A$30,0)),ROW(A$1:A$30)),ROW(A1))

A1:A30 = range of numbers

The sequence to check against is 1 to 30

2. Press the Ctrl + Shift + Enter Keys together to finish the formula. Copy down the formula until you get #NUM! errors meaning all missing numbers have been listed. See screenshot:

doc-identify-missing-numbers4


arrow blue right bubble Identify missing numbers sequence with VBA code

With following VBA code, you can also get the missing numbers sequence in a new worksheet. Please do as this:

1. Hold down the ALT + F11 keys, and it opens the Microsoft Visual Basic for Applications window.

2. Click Insert > Module, and paste the following macro in the Module Window.

Sub Missingvalues()
Dim rng As Range
Dim rng1 As Range
Dim StartV As Single, EndV As Single, i As Single, j As Single
Dim k() As Single
Dim WS As Worksheet
ReDim k(0)
On Error Resume Next
Set rng = Application.InputBox(Prompt:="Select a range:", _
Title:="Extract missing values", _
Default:=Selection.Address, Type:=8)
StartV = InputBox("Start value:")
EndV = InputBox("End value:")
On Error GoTo 0
Set WS = Sheets.Add
WS.Range("A1:A" & rng.Rows.CountLarge).Value = rng.Value
With WS.Sort
.SortFields.Add Key:=WS.Range("A1"), _
SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
.SetRange Range("A1:A" & rng.Rows.CountLarge)
.Header = xlNo
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Set rng1 = WS.Range("A1:A" & rng.Rows.CountLarge)
For i = StartV To EndV
On Error Resume Next
j = Application.Match(i, rng1)
If Err = 0 Then
If rng1(j, 1) <> i Then
k(UBound(k)) = i
ReDim Preserve k(UBound(k) + 1)
End If
Else
k(UBound(k)) = i
ReDim Preserve k(UBound(k) + 1)
End If
On Error GoTo 0
Next i
ReDim Preserve k(UBound(k) - 1)
WS.Range("B1") = "Missing values"
WS.Range("B2:B" & UBound(k) + 1) = Application.Transpose(k)
End Sub

3. Click doc-multiply-calculation-3 button to run the code, and a prompt box will pop out to tell you select a range that you want to use. See screenshot:

doc-identify-missing-numbers5

4. Then click OK, and enter the start value of your number sequence in the pop outing box.

doc-identify-missing-numbers6

5. And go on clicking OK, enter the end value of the number sequence. (Note: you must add 1 for your displayed end value, if your last value is 30, you should enter 31.) See screenshot:

doc-identify-missing-numbers7

6. Then click OK, and the missing numbers have been listed into a new worksheet. See screenshot:

doc-identify-missing-numbers8


Kutools for Excel

More than 120 Advanced Functions for Excel 2013, 2010, 2007 and Office 365.

screen shot

btn read more     btn download     btn purchase

Comments  

0#ROBERT1232013-11-20 12:07
Hi all....

Here you are finding missing numbers and pasting into other sheet...

But i need to findout missing rows insted of missing numbers...and i need it to paste that missing rows into a new sheet...

is there any solution for me.....

Thnaks
Reply | Reply with quote | Quote
0#KALPANA2014-06-20 09:04
hi
i need to find missimg number in total no of book.
i have 20000 book in my library . i have tally 18000 no of book .iam find the miss no's of books.
sir pleace help me.
Reply | Reply with quote | Quote
0#Chetan2014-06-23 08:27
Press Alt+F11 button to open VB Screen, Press Insert then Module and paste above mentioned code and Press F5, it'll show you all the Missing nos in adjacent coloum, if your Acc.No. Start with letter like B, replace it with 0, & then do above operation.
Reply | Reply with quote | Quote
0#ROBERT1232013-11-20 12:14
my report is like this....

iam uploading an excel file called abc into another excel called xyz....

That excel file abc rows directly writes into my Database...upto here i'm ok....

i need solution like this below....

no of rows read from abc excel while uploading into xyz excel...
no of rows inserted into database from abc excel...
if any rows while inserting into databse missing i need a message like "some rows were not inserted"
i need those missing rows into separate sheet

my code is in VBA,macros only...
Reply | Reply with quote | Quote
+2#Sreenivasulu Reddy2013-11-25 05:09
This script was not executed, compile error generator as "With WS.Sort"
Reply | Reply with quote | Quote
0#C N Murthy2013-12-16 09:44
1. VB script is not working as the same returned error as "With WS.Sort" as reported earlier by Mr.Reddy.

2. The formula =SMALL is working for series starting from 1 and NOT for series starting from say 201 to 535. Then this formula is returning all missing nos. starting from 1 whereas ideally we want the missing nos. within the range from 201 to 535.
Reply | Reply with quote | Quote
0#Satya2014-01-02 04:29
Dear Sir,
It is working fine sir,
I put this formula in excel VB module , later I saved as *.xla.
now pl help me, how to use it?
Reply | Reply with quote | Quote
0#bobo2014-02-07 16:33
Great VBA code! Thank you very much for it.

As I have no idea about how to create a VBA code, could you please let me know if there is any chance to adapt this code to my needs as follows:
1. the selected range to be by default (e.g. $C$2:$C$5000);
2. the new worksheet to have only the column with the missing numbers (and without "missing values" header);
3. to be able to add exceptions (e.g. numbers 4550432, 4552357, etc) that will not displayed in the new worksheet;
4. if some missing numbers are subsequently added in the original worksheet, these numbers to be automatically erased from the new worksheet, without running again the macro;
5. when I run again the macro, to create the same worksheet, with a particularly name.

Thank you so much in advance!
Reply | Reply with quote | Quote
+1#Farooq2014-02-24 10:47
I really enjoyed by executing all three functions in my excel sheet. It was marvelous.
Reply | Reply with quote | Quote
+1#midnightsquall2014-03-04 01:59
I tried the VBA code, and it doesn't work for dates. By that I mean if the range of data I'm using to determine for missing values is in the format: dd/mm/yyyy as opposed to a single integer. Is there an alteration to the VBA code that allows for the same process to be carried out?

I used the =IF function and that works fine, but I'd be keen to get it working with the macros as well.
Reply | Reply with quote | Quote
+1#shanmugasundaram2014-03-13 05:30
Hi sir,

It is working and very useful this formula thank you
Reply | Reply with quote | Quote
+1#Srikant.n2014-03-24 05:13
Thank you, it was a very useful tool as i had to search 1 missing number in 1-7000.

thanking you once again
Reply | Reply with quote | Quote
0#Hama Chigubu2014-04-01 09:41
It worked for me, many thanx!!! :-)
Reply | Reply with quote | Quote
0#Valda2014-04-25 17:55
Awesome. It worked. Grateful
Reply | Reply with quote | Quote
0#Chetan Sonawane2014-04-30 11:08
I want to find missing numbers starting from B00001 to B11223 which starts with alphabets, kindly send code for this.
Reply | Reply with quote | Quote
0#jawale Jyotsna2014-05-26 08:24
Dear Sir,
I want to find out missing numbers starting from S-1 to S-30,000 and J-1 to J-7000, U-1 to U-26932 and C-1 to C-1836 please send code, Thanking You. :-)
Reply | Reply with quote | Quote
0#jawale Jyotsna2014-05-26 08:26
Dear,
I want to find out missing numbers from S-1 to S-27000 and J-1 to J-7000 , U-1 to U-27000, C-1 to C-1848
Reply | Reply with quote | Quote
0#jawale Jyotsna2014-05-26 11:23
Dear sir
I want to find out d missing numbers from S-1 to S-27000 and J-1 to J-6500. Please send me the vba code for d same
Thaniking you,

Jawale Jyo
Reply | Reply with quote | Quote
0#jawale Jyotsna2014-05-26 11:34
This script was not executed, compile error generator as "With WS.Sort"
Reply | Reply with quote | Quote
0#jawale Jyotsna2014-05-26 11:35
Dear sir
I want to find out d missing numbers from S-1 to S-27000 and J-1 to J-6500. Please send me the vba code for d same.
The code available on net , when executed gives compilation error with WS.Sort
Thaniking you,

Jawale Jyo
Reply | Reply with quote | Quote
0#marty2014-07-16 16:03
will any of these work for phone numbers if I'm looking for phone numbers that are missing in a sequence?
Reply | Reply with quote | Quote

Add comment


Security code
Refresh