How to detect missing numbers within a list?

happydz

New Member
Joined
Jan 11, 2017
Messages
46
Office Version
  1. 2010
I have a column of serial numbers that are randomly classified. Is there an option in Excel that detects the missing numbers within this list?
Thank you

[TABLE="width: 500"]
[TR]
[TD][TABLE="width: 80"]
[TR]
[TD="class: xl65, width: 80"]NUM[/TD]
[/TR]
[TR]
[TD="class: xl66"]4001[/TD]
[/TR]
[TR]
[TD="class: xl66"]4003[/TD]
[/TR]
[TR]
[TD="class: xl66"]4004[/TD]
[/TR]
[TR]
[TD="class: xl66"]4005[/TD]
[/TR]
[TR]
[TD="class: xl66"]4006[/TD]
[/TR]
[TR]
[TD="class: xl66"]4007[/TD]
[/TR]
[TR]
[TD="class: xl66"]4008[/TD]
[/TR]
[TR]
[TD="class: xl66"]4009[/TD]
[/TR]
[TR]
[TD="class: xl66"]4010[/TD]
[/TR]
[TR]
[TD="class: xl66"]4011[/TD]
[/TR]
[TR]
[TD="class: xl66"]4013[/TD]
[/TR]
[TR]
[TD="class: xl66"]4014[/TD]
[/TR]
[TR]
[TD="class: xl66"]4015[/TD]
[/TR]
[TR]
[TD="class: xl66"]4016[/TD]
[/TR]
[TR]
[TD="class: xl66"]4017[/TD]
[/TR]
[TR]
[TD="class: xl66"]4018[/TD]
[/TR]
[TR]
[TD="class: xl66"]4019[/TD]
[/TR]
[TR]
[TD="class: xl66"]4020[/TD]
[/TR]
[TR]
[TD="class: xl66"]4023[/TD]
[/TR]
[/TABLE]
[/TD]
[/TR]
[/TABLE]
 
Last edited:

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Hello. Not that I can think of.

If you define precisely what is required, it can be done by code.
 
Upvote 0
[TABLE="class: grid, width: 500"]
[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]NUM[/TD]
[TD]Missing Numbers[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]4001[/TD]
[TD]4002[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]4003[/TD]
[TD]4012[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]4004[/TD]
[TD]4021[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]4005[/TD]
[TD]4022[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]4006[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD]4007[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]8[/TD]
[TD]4008[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]9[/TD]
[TD]4009[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]10[/TD]
[TD]4010[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]11[/TD]
[TD]4011[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]12[/TD]
[TD]4013[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]13[/TD]
[TD]4014[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]14[/TD]
[TD]4015[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]15[/TD]
[TD]4016[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]16[/TD]
[TD]4017[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]17[/TD]
[TD]4018[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]18[/TD]
[TD]4019[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]19[/TD]
[TD]4020[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]20[/TD]
[TD]4023[/TD]
[TD][/TD]
[/TR]
[/TABLE]


B2:
Code:
=IFERROR(AGGREGATE(15,6,ROW(INDIRECT(MIN(A:A)&":"&MAX(A:A)))/(COUNTIF(A$2:A$20,ROW(INDIRECT(MIN(A:A)&":"&MAX(A:A))))+COUNTIF(B$1:B1,ROW(INDIRECT(MIN(A:A)&":"&MAX(A:A))))=0),1),"")

This should work for positive integers below about 1,000,000.
 
Upvote 0
.
Eric:

Following this interesting thread. Tried the formula but it doesn't produce any numbers here.

???
 
Upvote 0
Hmm. Not sure why you're not getting any numbers. This thread has HTML turned off, so I had to just make a table, but I assure you, it works on my test sheet. I assume your version of Excel has AGGREGATE? I'll have to cogitate a bit to see if I can think of any other reasons.
 
Upvote 0
.
That is most likely it. Using ver 2007. I type in the term AGGREGATE and nothing happens like it usually does where
Excel provides auto suggestions for the formula term.

(found a few websites that indicate ver 2003 and 2007 don't have AGGREGATE)
 
Last edited:
Upvote 0
Here's how to do it with Excel 2007. According to my references, IFERROR is available:

=IFERROR(SMALL(IFERROR(ROW(INDIRECT(MIN(A:A)&":"&MAX(A:A)))/(COUNTIF(A$2:A$20,ROW(INDIRECT(MIN(A:A)&":"&MAX(A:A))))+COUNTIF(B$1:B1,ROW(INDIRECT(MIN(A:A)&":"&MAX(A:A))))=0),""),1),"")

This requires being entered with Control+Shift+Enter.
 
Upvote 0
This thread has HTML turned off,..
FYI: The thread has now been moved to the Excel Questions forum as that seems to be where it should be, so now HTML is available should you want.
 
Upvote 0
Here are some more compact alternatives that also avoid the volatile function INDIRECT. I have not used MIN & MAX to find the endpoints since the OP's data is in ascending order.

Excel Workbook
ABC
1NUMMissing NumbersMissing Numbers
2400140024002
3400340124012
4400440214021
5400540224022
64006
74007
84008
94009
104010
114011
124013
134014
144015
154016
164017
174018
184019
194020
204023
21
Sheet2 (2)
 
Upvote 0

Forum statistics

Threads
1,223,891
Messages
6,175,229
Members
452,621
Latest member
Laura_PinksBTHFT

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top