can somone please assist me what formula I can use to find the missing in a
sequence number?
see example below. How could I find the missing 1327, 1330 and 1333?
Order #
1325
1326
1328
1329
1331
1332
1334
1335
Any help will be appreciated.
Thank youj,
Beth
All of the following are **array** formulas. After pasting them into a cell,
they must be entered by holding down <ctrl><shift> while hitting <enter>. If
you do this correctly, Excel will place braces {...} around the formula.
In the formulas below, "Order" refers to the range in which you have these
values listed. I NAME'd a sample range, but you could substitute an absolute
reference (e.g. $A$2:$A$16)
For the missing values in descending order, enter:
=LARGE(IF(COUNTIF(Order,ROW(INDIRECT(MIN(Order)
&":"&MAX(Order))))=0,ROW(INDIRECT(MIN(Order)
&":"&MAX(Order))),""),ROWS($1:1))
and copy/drag down until you begin to get #NUM! errors
For the missing values in ascending order, enter:
=LARGE(IF(COUNTIF(Order,ROW(INDIRECT(MIN(Order)
&":"&MAX(Order))))=0,ROW(INDIRECT(MIN(Order)
&":"&MAX(Order))),""),COUNT(IF(COUNTIF(Order,ROW(INDIRECT(MIN(Order)
&":"&MAX(Order))))=0,ROW(INDIRECT(MIN(Order)
&":"&MAX(Order))),""))+1-ROWS($1:1))
and copy/drag down until you begin to get #NUM! errors
If you want to avoid the error messages, you can use one of the following
formulas instead:
If you are running Excel 2007:
Descending order:
=IFERROR(LARGE(IF(COUNTIF(Order,ROW(INDIRECT(MIN(Order)
&":"&MAX(Order))))=0,ROW(INDIRECT(MIN(Order)
&":"&MAX(Order))),""),ROWS($1:1)),"")
Ascending order:
=IFERROR(LARGE(IF(COUNTIF(Order,ROW(INDIRECT(MIN(Order)
&":"&MAX(Order))))=0,ROW(INDIRECT(MIN(Order)
&":"&MAX(Order))),""),COUNT(IF(COUNTIF(Order,ROW(INDIRECT(MIN(Order)
&":"&MAX(Order))))=0,ROW(INDIRECT(MIN(Order)
&":"&MAX(Order))),""))+1-ROWS($1:1)),"")
If you are running a version of Excel prior to 2007:
Descending order:
=IF(ISERR(LARGE(IF(COUNTIF(Order,ROW(INDIRECT(MIN(Order)
&":"&MAX(Order))))=0,ROW(INDIRECT(MIN(Order)
&":"&MAX(Order))),""),ROWS($1:1))),"",LARGE(IF(COUNTIF(Order,ROW(INDIRECT(MIN(Order)
&":"&MAX(Order))))=0,ROW(INDIRECT(MIN(Order)
&":"&MAX(Order))),""),ROWS($1:1)))
Ascending order:
&":"&MAX(Order))),""),COUNT(IF(COUNTIF(Order,ROW(INDIRECT(MIN(Order)
&":"&MAX(Order))))=0,ROW(INDIRECT(MIN(Order)
&":"&MAX(Order))),""))+1-ROWS($1:1))),"",LARGE(IF(COUNTIF(Order,ROW(INDIRECT(MIN(Order)
&":"&MAX(Order))))=0,ROW(INDIRECT(MIN(Order)
&":"&MAX(Order))),""),COUNT(IF(COUNTIF(Order,ROW(INDIRECT(MIN(Order)
&":"&MAX(Order))))=0,ROW(INDIRECT(MIN(Order)
&":"&MAX(Order))),""))+1-ROWS($1:1)))
--ron