+ Reply to Thread
Results 1 to 12 of 12

formula for missing numbers in a range based on criteria

  1. #1
    Forum Contributor
    Join Date
    04-26-2012
    Location
    New Jersey
    MS-Off Ver
    Excel 2021
    Posts
    211

    formula for missing numbers in a range based on criteria

    Hi everyone,

    I am looking for a formula that finds missing numbers in a range based on criteria. I searched but there was nothing based on criteria.

    Here's an example of my data set.

    table.jpg

    In this example, I need to know which number(s) are missing for report 20-A-1, version 0. The answer should be 2, of course. Similarly, I need to know which number(s) are missing for report 20-A-1, version 1. The answer should be 2, 3, and 4

    The last report, 21-B-2, version 0 doesn't have any missing numbers, so the formula should not return anything.

    The sample file is attached.

    Thank you for your help.
    Attached Files Attached Files
    Last edited by mq1973; 01-29-2022 at 12:14 AM.

  2. #2
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,213

    Re: formula for missing numbers in a range based on criteria

    Please try

    PHP Code: 
    =MID(SUBSTITUTE(TEXT(NPV(9,IF(ISNA(MATCH(ROW(INDEX(Z:Z,MIN(IF(($A$2:$A$10=A2)*($B$2:$B$10=B2),$C$2:$C$10))):INDEX(Z:Z,MAX(IF(($A$2:$A$10=A2)*($B$2:$B$10=B2),$C$2:$C$10)))),IF(($A$2:$A$10=A2)*($B$2:$B$10=B2),$C$2:$C$10),)),ROW(INDEX(Z:Z,MIN(IF(($A$2:$A$10=A2)*($B$2:$B$10=B2),$C$2:$C$10))):INDEX(Z:Z,MAX(IF(($A$2:$A$10=A2)*($B$2:$B$10=B2),$C$2:$C$10))))*10^9)),REPT("\,0",9)),",0",),2,20
    Ctrl+Shift+Enter
    Attached Files Attached Files

  3. #3
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,594

    Re: formula for missing numbers in a range based on criteria

    Try this.
    In G2 then copied across.

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Pl note
    Array formula should be confirmed with Ctrl+Shift+Enter keys together.
    If answere is satisfactory press * to add reputation.

  4. #4
    Forum Contributor
    Join Date
    04-26-2012
    Location
    New Jersey
    MS-Off Ver
    Excel 2021
    Posts
    211

    Re: formula for missing numbers in a range based on criteria

    Quote Originally Posted by Bo_Ry View Post
    Please try

    PHP Code: 
    =MID(SUBSTITUTE(TEXT(NPV(9,IF(ISNA(MATCH(ROW(INDEX(Z:Z,MIN(IF(($A$2:$A$10=A2)*($B$2:$B$10=B2),$C$2:$C$10))):INDEX(Z:Z,MAX(IF(($A$2:$A$10=A2)*($B$2:$B$10=B2),$C$2:$C$10)))),IF(($A$2:$A$10=A2)*($B$2:$B$10=B2),$C$2:$C$10),)),ROW(INDEX(Z:Z,MIN(IF(($A$2:$A$10=A2)*($B$2:$B$10=B2),$C$2:$C$10))):INDEX(Z:Z,MAX(IF(($A$2:$A$10=A2)*($B$2:$B$10=B2),$C$2:$C$10))))*10^9)),REPT("\,0",9)),",0",),2,20
    Ctrl+Shift+Enter
    Thank you so much Bo-Ry. This solution is perfect. I love that the missing numbers are in one cell. Thank you so much

  5. #5
    Forum Contributor
    Join Date
    04-26-2012
    Location
    New Jersey
    MS-Off Ver
    Excel 2021
    Posts
    211

    Re: formula for missing numbers in a range based on criteria

    Quote Originally Posted by kvsrinivasamurthy View Post
    Try this.
    In G2 then copied across.

    Please Login or Register  to view this content.
    Thanks you so much kvsrinivasamurthy for your help. I really appreciate it. While your solution works of course, Bo-Ry solution works better for because I can copy down the formula. I have hundreds of rows of data and ability to copy down the formula makes is easier.

  6. #6
    Forum Contributor
    Join Date
    04-26-2012
    Location
    New Jersey
    MS-Off Ver
    Excel 2021
    Posts
    211

    Re: formula for missing numbers in a range based on criteria

    Hi Bo-Ry,

    I was testing the formula and noticed that it didn't work when I changed the item # in cell 10 to 13. The formula shows 2,3,4,5,7,9,1,2 but it should be 2,3,4,5,7,9,10,11,12
    Attachment 765593

  7. #7
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,591

    Re: formula for missing numbers in a range based on criteria

    Selecting Attachment 765593 results in the following message: "Invalid Attachment specified. If you followed a valid link, please notify the administrator".
    Please utilize the information in the banner at the top of the page to attach files.
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

  8. #8
    Forum Contributor
    Join Date
    04-26-2012
    Location
    New Jersey
    MS-Off Ver
    Excel 2021
    Posts
    211

    Re: formula for missing numbers in a range based on criteria

    Quote Originally Posted by JeteMc View Post
    Selecting Attachment 765593 results in the following message: "Invalid Attachment specified. If you followed a valid link, please notify the administrator".
    Please utilize the information in the banner at the top of the page to attach files.
    Thanks, JeteMc for letting me know. I attached a new Excel file and an image as well.

    missing number.png
    Attached Files Attached Files

  9. #9
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,594

    Re: formula for missing numbers in a range based on criteria

    ARRAY formula in D2 then copy down.
    Please Login or Register  to view this content.
    Attached Files Attached Files

  10. #10
    Forum Contributor
    Join Date
    04-26-2012
    Location
    New Jersey
    MS-Off Ver
    Excel 2021
    Posts
    211

    Re: formula for missing numbers in a range based on criteria

    Quote Originally Posted by kvsrinivasamurthy View Post
    ARRAY formula in D2 then copy down.
    Please Login or Register  to view this content.
    Perfect! Thank you so much kvsrinivasamurthy! I appreciate your help.

  11. #11
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,594

    Re: formula for missing numbers in a range based on criteria

    If you interested.
    This formula gives the missing numbers till next occurrence.
    In F2 copy down(ARRAY formula)

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by kvsrinivasamurthy; 01-31-2022 at 12:16 AM.

  12. #12
    Forum Contributor
    Join Date
    04-26-2012
    Location
    New Jersey
    MS-Off Ver
    Excel 2021
    Posts
    211

    Re: formula for missing numbers in a range based on criteria

    Quote Originally Posted by kvsrinivasamurthy View Post
    If you interested.
    This formula gives the missing numbers till next occurrence.
    In F2 copy down(ARRAY formula)

    Please Login or Register  to view this content.
    Thank you again. For my application, your earlier solution works better since I only need to know the missing numbers within a range.

    Best regards,
    M
    Last edited by mq1973; 01-31-2022 at 12:22 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 1
    Last Post: 04-09-2021, 11:09 AM
  2. Replies: 4
    Last Post: 10-19-2017, 08:12 AM
  3. Replies: 2
    Last Post: 01-21-2016, 02:02 PM
  4. Formula for identify missing numbers from a given range.
    By Noorking in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 05-12-2015, 05:14 AM
  5. [SOLVED] find missing date on every group date list based on range and criteria
    By k1dr0ck in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-25-2013, 01:26 AM
  6. Fill Numbers Missing In A Range
    By dannyfromnj in forum Excel General
    Replies: 1
    Last Post: 01-04-2007, 06:24 PM
  7. Missing Numbers from a Range
    By robmeister in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-16-2005, 08:03 AM

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