+ Reply to Thread
Results 1 to 37 of 37

Determine Missing #s in columns

  1. #1
    Forum Contributor
    Join Date
    01-18-2016
    Location
    OBX NC
    MS-Off Ver
    Office 2013
    Posts
    153

    Determine Missing #s in columns

    I have a column F with 71 rows in it. The cell value can vary between 1-26. What I am trying to do is have formula that will tell me what is 'missing' from col f to make a 'complete' series

    For ex:
    1
    2
    4
    5
    7
    8
    9
    etc...through 26
    in this case / example I am missing 3 and 6. If series is complete - (I have all 26 numbers), to display - all good. This column is not sorted.

    Any ideas?

  2. #2
    Valued Forum Contributor spitfireblue's Avatar
    Join Date
    01-29-2015
    Location
    Adelaide, Australia
    MS-Off Ver
    2007,2010,2016
    Posts
    611

    Re: Determine Missing #s in columns

    You could do it with a macro...

    Please Login or Register  to view this content.
    Regards,
    Stephen

    If you feel someone has helped you please thank them and click on the star on their post to add reputation.
    Please ensure that you use code tags where relevant, and mark solved threads as solved.
    Most of all please be respectful and understanding of others.

  3. #3
    Forum Contributor
    Join Date
    01-18-2016
    Location
    OBX NC
    MS-Off Ver
    Office 2013
    Posts
    153

    Re: Determine Missing #s in columns

    Thanks Spitfireblue,

    Was hoping to display results in another cell automatically as values are entered in the f col.

  4. #4
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 V 2503
    Posts
    13,702

    Re: Determine Missing #s in columns

    Try array entering this and filling down until you get blanks. If you aren’t familiar with array-entered formulas array enter means the formula must be committed from edit mode by simultaneously pressing and holding down Ctrl and Shift while hitting Enter.
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Dave

  5. #5
    Forum Contributor
    Join Date
    01-18-2016
    Location
    OBX NC
    MS-Off Ver
    Office 2013
    Posts
    153

    Re: Determine Missing #s in columns

    Flame,

    I have included a sample of data, and what I am waiting the output to be. I have also included a sample formula that displays the array correctly but not outputting correctly.
    Thanks again!
    Jack
    Attached Files Attached Files

  6. #6
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 V 2503
    Posts
    13,702

    Re: Determine Missing #s in columns

    Try changing your formula (array entered) to
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Did mine not do what you want?

  7. #7
    Forum Contributor
    Join Date
    01-18-2016
    Location
    OBX NC
    MS-Off Ver
    Office 2013
    Posts
    153

    Re: Determine Missing #s in columns

    Yes yours worked perfectly. That was just something I was trying to test. It looks like I will have to a helper celsl(s) to do what I want. I am attempting to bring the results to a single cell For example:


    cell j75 - 1,6,9,12,13,16,21,24,25,26 in a a single cell. Issue is that I dont know how many numbers will be displayed, it could be 1 number or 26 depending if there is any data included. I have uploaded another exaple sheet to show what I mean - Your soution / formula is on the far right
    Attached Files Attached Files

  8. #8
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 V 2503
    Posts
    13,702

    Re: Determine Missing #s in columns

    Aha! You hadn't mentioned that.

    I know of no formula-only way to concatenate in Excel 2013. Newer products might provide a way.

    You will need to use a combination of Excel functions and VBA.

    Below is a user defined function. The source link is:

    http://www.excelforum.com/tips-and-t...ml#post3096647

    How to install your new code
    1. Copy the Excel VBA code
    2. Select the workbook in which you want to store the Excel VBA code
    3. Press Alt+F11 to open the Visual Basic Editor
    4. Choose Insert > Module
    5. Edit > Paste the macro into the module that appeared
    6. Close the VBEditor
    7. Save your workbook (Excel 2007+ select a macro-enabled file format, like *.xlsm)



    Please Login or Register  to view this content.

    Then array enter this formula (as done in K11 of the attached).
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files

  9. #9
    Forum Contributor
    Join Date
    01-18-2016
    Location
    OBX NC
    MS-Off Ver
    Office 2013
    Posts
    153

    Re: Determine Missing #s in columns

    Flame,

    I apologize for long delay. You solution worked perfectly with the VB code. I got all to work. However I do need to throw one more monkey into to the equation.......

    I currently have a 'test' account that is also in the list (f1:f71)- it gets his number from same page that I added your code and drug down.

    For example this week his # is 15. I need it to count this twice for it be counted once, my issue is that number may change week to week. I want 15 to display until a valid 15 is entered.

    You will see what I am saying in example we have used - q1. Basically it needs to count this # twice before it can say it is missing from column.

    Thanks again!
    Attached Files Attached Files

  10. #10
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 V 2503
    Posts
    13,702

    Re: Determine Missing #s in columns



    The upload does not represent the points above re: #15 etc.

    Also the output does include a 1.

    What am I missing?


    this works somewhat
    I have the array right, except it
    pulls small number ie 2
    It should include 1




    1
    6
    9
    12
    13
    16
    21
    24
    25
    26
    Last edited by FlameRetired; 03-12-2017 at 08:48 PM.

  11. #11
    Forum Contributor
    Join Date
    01-18-2016
    Location
    OBX NC
    MS-Off Ver
    Office 2013
    Posts
    153

    Re: Determine Missing #s in columns

    Flame,
    Ok lets start over from the top. I currently have a col (f) on page one that has various #s I through 15. One row is a test acct that ALSO has in same col (F) The test acct # is done various formulas, so I never know what its going to be. I did as you instructed,
    =IFERROR(SMALL(IF(ISNA(MATCH(ROW(sheet1!$1:$15),sheet1!$F$2:$F$71,0)),ROW(sheet1!$1:$15)),ROWS(sheet1!$1:1)),"")
    and drug down on sheet 2 - this worked perfectly. I then mentioned that I wanted to display 'missing' numbers in a cell on sheet one - You provided me with the concatall code - this is what I have on page one:
    =concatall(IF(COUNTIF($F$2:$F$71,ROW($F$1:$F$15))=0,ROW($F$1:$F$15),""),",")

    AGAIN all works perfectly. However for proper stats I need to have test acct f col counted twice before sheet declares that it is missing. Currently It shows #15 as 'not missing' because of test acct - when actually it is. - does that make sense? I currently have test acct (cell f from page 1) info on sheet 2 in its own cell.

  12. #12
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 V 2503
    Posts
    13,702

    Re: Determine Missing #s in columns

    Edited twice

    I cannot discern your intent from your last description and the latest formula

    =concatall(IF(COUNTIF($F$2:$F$71,ROW($F$1:$F$15))=0,ROW($F$1:$F$15),""),",")

    Why is it now ROW($F$1:$F$15)?
    Last edited by FlameRetired; 03-17-2017 at 08:21 PM.

  13. #13
    Forum Contributor
    Join Date
    01-18-2016
    Location
    OBX NC
    MS-Off Ver
    Office 2013
    Posts
    153

    Re: Determine Missing #s in columns

    Flame,
    Very observant! Sheet is actuallu 2 sheets, in one (6 sheets) One that I am speaking of does 1-15 and other does 1-26. I only assumed formula could be carried to other.

    Pal...Why you got 'Retired' in your name..... Those brain cells are kicking more than ever, my friend!

    Jack

  14. #14
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 V 2503
    Posts
    13,702

    Re: Determine Missing #s in columns

    Thank you for the kind words.

    Let's see if they're still 'kicking'

    If I interpret correctly and I understand the ROW argument to be ROW($1:$15) try this array entered formula using the Concatall function.
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    In your upload it returns
    1,3,5,6,7,8,9,10,11,12,13,14,15



    Edit Actually this array formula is simpler.
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Last edited by FlameRetired; 03-18-2017 at 02:16 AM.

  15. #15
    Forum Contributor
    Join Date
    01-18-2016
    Location
    OBX NC
    MS-Off Ver
    Office 2013
    Posts
    153

    Re: Determine Missing #s in columns

    Ok Flame,

    Your solution DID work for the concatall part But believe I may of been over thinking and explaining the process. I have since created a new test sheet. PLEASE disregard all others. I believe you will get a better understanding of what I am attempting to do.
    Attached Files Attached Files

  16. #16
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 V 2503
    Posts
    13,702

    Re: Determine Missing #s in columns

    This is array entered in Q2 of the attached. If I understand correctly it should return 8,10,11 and 15 if the test value is 15 and there are fewer than two 15s in F2:F25.


    =IFERROR(SMALL(IF(ISNA(MATCH(ROW(INDIRECT("1:"&$N$1))&"",IF(COUNTIF($F$2:$F$25,$N$1)<2,SUBSTITUTE($F$2:$F$25,$N$1,""),$F$2:$F$25&""),0)),ROW(INDIRECT("1:"&$N$1))),ROWS($2:2)),"")
    Attached Files Attached Files
    Last edited by FlameRetired; 03-18-2017 at 11:34 PM.

  17. #17
    Forum Contributor
    Join Date
    01-18-2016
    Location
    OBX NC
    MS-Off Ver
    Office 2013
    Posts
    153

    Re: Determine Missing #s in columns

    Flame,
    We getting somewhere. I did tweak your line of code:
    =IFERROR(SMALL(IF(ISNA(MATCH(ROW(INDIRECT("1:15"))&"",IF(COUNTIF($F$2:$F$25,$N$1)<2,SUBSTITUTE($F$2:$F$25,$N$1,""),$F$2:$F$25&""),0)),ROW(INDIRECT("1:15"))),ROWS($2:2)),"")

    for other sheet I changed the 15 to 26.... All works fine. Now thats out of the way.
    I cant seem to get the concatall portion to work as it was before. To simply avoid confusion
    How do I get YOUR results from col q to displayed in sgl cell? HORT......

  18. #18
    Forum Contributor
    Join Date
    01-18-2016
    Location
    OBX NC
    MS-Off Ver
    Office 2013
    Posts
    153

    Re: Determine Missing #s in columns

    Flame,

    Nevermind...I got...Thank you so much!

  19. #19
    Forum Contributor
    Join Date
    01-18-2016
    Location
    OBX NC
    MS-Off Ver
    Office 2013
    Posts
    153

    Re: Determine Missing #s in columns

    Flame,

    I promise, this will be last question. Now that you see what I was try to solve with the test acct(N1) - needing to be counted twice to be considered missing.How would I do same with another value - say in o1 You have to remember that these could possibly match. so would I do something maybe with an 'or' statement in code below

    =IFERROR(SMALL(IF(ISNA(MATCH(ROW(INDIRECT("1:15"))&"",IF(COUNTIF($F$2:$F$25,$N$1)<2,SUBSTITUTE($F$2:$F$25,$N$1,""),$F$2:$F$25&""),0)),ROW(INDIRECT("1:15"))),ROWS($2:2)),"")

  20. #20
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 V 2503
    Posts
    13,702

    Re: Determine Missing #s in columns

    Jack, I think I am going to need another upload with 2 or three qualifying examples and 1 or 2 exceptions. I suspect my SUBSTITUTE strategy is not going to work here, but I need to make certain of what it is I am working with.

  21. #21
    Forum Contributor
    Join Date
    01-18-2016
    Location
    OBX NC
    MS-Off Ver
    Office 2013
    Posts
    153

    Re: Determine Missing #s in columns

    Flame,

    Got a new sheet for ya. As I stated, It works perfectly for n1 - I need to do same for o1. While rare, n1 and o1 could be same since these are dynamically driven.
    Attached Files Attached Files

  22. #22
    Forum Contributor
    Join Date
    01-18-2016
    Location
    OBX NC
    MS-Off Ver
    Office 2013
    Posts
    153

    Re: Determine Missing #s in columns

    In the scene N1 shows as it should cause count is less than 2 However I also need to have o1 included in col q list (it currently at count 1). If by chance that n1 and o1 are same - then that means there would have to be actually 3 instances before coming off missing list

    Thanks again!
    Jack
    Attached Files Attached Files

  23. #23
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 V 2503
    Posts
    13,702

    Re: Determine Missing #s in columns

    Before proceeding I noticed you've changed ROW(INDIRECT("1:"&$N$1)) to ROW(INDIRECT("1:15")).

    ROW(INDIRECT("1:15")) does nothing that ROW($1:$15) isn't already doing.

    I used ROW(INDIRECT("1:"&$N$1)) in an attempt to establish a dynamic upper boundary to replace ROW($1:$15). In it's present form the upper boundary is 'Test acct' as is ROW($1:$15).

    I suspect that needs to be different if there are numbers larger than 'Test acct' in F2:F25. Are there?

  24. #24
    Forum Contributor
    Join Date
    01-18-2016
    Location
    OBX NC
    MS-Off Ver
    Office 2013
    Posts
    153

    Re: Determine Missing #s in columns

    Correct... THERE will NEVER be a higher 15 (sheet1) or 26 on sheet2. I changed them respectfully and all works fine... for N! Now I need to include o1 to the list in col q - only if count <2 However if n1 and o1 are same obvisously count would need to be <3 to show up on 'missing list'

  25. #25
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 V 2503
    Posts
    13,702

    Re: Determine Missing #s in columns

    same obvisously count would need to be <3 to show up on 'missing list'
    Yikes! I just noticed that detail in post #22.

    OK then as I currently understand there will always be a some value in N1 and O1, and there will never be an N1 only situation.

    Will there ever be additional 'Test acct' #s? For example P1 also?

  26. #26
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 V 2503
    Posts
    13,702

    Re: Determine Missing #s in columns

    More confusion.

    I notice that there are values in F2:F25 that reference N1:O1 !!! I thought the values in F2:F25 were coming from a data feed.

  27. #27
    Forum Contributor
    Join Date
    01-18-2016
    Location
    OBX NC
    MS-Off Ver
    Office 2013
    Posts
    153

    Re: Determine Missing #s in columns

    No more test accts I swear! Yes n1 and o1 will ALWAYS have a dynamic value. Tests could be any number between the row(1:15) - (1-15)

    the two references in f1:f25 was simply for test puposes. Data is actually pulled into n1 or o1 from other sheets.
    column f data is keyed in directly with exception of the two 2 test # that are n1 and o1.
    Last edited by jackf-nc; 03-19-2017 at 05:11 PM.

  28. #28
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 V 2503
    Posts
    13,702

    Re: Determine Missing #s in columns

    I have not done a painstaking check of this. What I have checked holds up so far.

    Array entered in Q2

    =IFERROR(SMALL(IF(ISNA(MATCH(ROW($1:$15)&"",IF(($N$1=$O$1)*(COUNTIF($F$2:$F$25,$N$1)<3),SUBSTITUTE($F$2:$F$25,$N$1,""),IF((COUNTIF($F$2:$F$25,$N$1)<2)*(COUNTIF($F$2:$F$25,$O$1)>1),SUBSTITUTE($F$2:$F$25,$N$1,""),IF((COUNTIF($F$2:$F$25,$N$1)>1)*(COUNTIF($F$2:$F$25,$O$1)<2),SUBSTITUTE($F$2:$F$25,$O$1,""),IF((COUNTIF($F$2:$F$25,$N$1)<2)*(COUNTIF($F$2:$F$25,$O$1)<2),SUBSTITUTE(SUBSTITUTE($F$2:$F$25,$N$1,""),$O$1,""),$F$2:$F$25&"")))),0)),ROW($1:$15)),ROWS($2:2)),"")

    I am still hoping to come up with something more compact and direct than nested IFs and SUBSTITUTEs.

  29. #29
    Forum Contributor
    Join Date
    01-18-2016
    Location
    OBX NC
    MS-Off Ver
    Office 2013
    Posts
    153

    Re: Determine Missing #s in columns

    those sparks are still flying! Appears to work so far.....THANK YOU!!! (yes I was yelling - long way to way IL!)

    Jack

  30. #30
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 V 2503
    Posts
    13,702

    Re: Determine Missing #s in columns

    LOL ... I heard that.

    You're welcome.

  31. #31
    Forum Contributor
    Join Date
    01-18-2016
    Location
    OBX NC
    MS-Off Ver
    Office 2013
    Posts
    153

    Re: Determine Missing #s in columns

    Flame,

    I promised no test accts. All is good! But for some reason I have continued thinking about it all day. Now that you know the results I wanted. Would it have been easier to concatall the missing numbers - test accts would of not been there for 1st entry either by user user test. Then add those tests to the concatall cat list? With the variable that those numbers would have to be counted 2? Is my logic off? Does that make sense? Am not making any changes, just thinking outside the box and I may be entirely on logic as my original request did not provide enough info. You were great I really appreciate it, my friend!
    Stay warm!
    Jack

  32. #32
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 V 2503
    Posts
    13,702

    Re: Determine Missing #s in columns

    I don't understand. I think you will need to upload another example with expected results.

  33. #33
    Forum Contributor
    Join Date
    01-18-2016
    Location
    OBX NC
    MS-Off Ver
    Office 2013
    Posts
    153

    Re: Determine Missing #s in columns

    Flame,

    All is good.........I was just thinking of simpler way of achieved answer I wanted - is correct with the substitutes. Y thinking was that the test accts were already 'missing' from concatall list. Would it not of been easier to 'add' those back to concatall list if not picked by regular users? Am I wrong with my logic? Trust me I am learning - and a lot from you.... Was just being curious. I dont plan to change a thing!!!!!

  34. #34
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 V 2503
    Posts
    13,702

    Re: Determine Missing #s in columns

    I can't understand the question. So I am not able to give a coherent response.

  35. #35
    Forum Contributor
    Join Date
    01-18-2016
    Location
    OBX NC
    MS-Off Ver
    Office 2013
    Posts
    153

    Re: Determine Missing #s in columns

    Flame,
    Noticed a error with the formula. I have submitted a brand new example of what I am speaking of. I think this should give a overall better example.

    I believe culprit to be in the rows that it starts the counts??? I hope you can take a look and tell me what the heck is going on?

    Thanks,
    Jack
    Attached Files Attached Files

  36. #36
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 V 2503
    Posts
    13,702

    Re: Determine Missing #s in columns

    It's the SUBSTITUTE function. When the formula substitutes 3 for "" that turns 13 into a 1. My bad.

    I need to do a complete rethink on this one.

  37. #37
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 V 2503
    Posts
    13,702

    Re: Determine Missing #s in columns

    Try array entering this updated version.

    =IFERROR(SMALL(IF(ISNA(MATCH(ROW($1:$26)&"",IF(($I$5=$I$2)*(COUNTIF($F$2:$F$71,$I$5)<3)*(LEN($I$5)=LEN($F$2:$F$71)),SUBSTITUTE($F$2:$F$71,$I$5,""),IF((COUNTIF($F$2:$F$71,$I$5)<2)*(COUNTIF($F$2:$F$71,$I$2)>1)*(LEN($I$5)=LEN($F$2:$F$71)),SUBSTITUTE($F$2:$F$71,$I$5,""),IF((COUNTIF($F$2:$F$71,$I$5)>1)*(COUNTIF($F$2:$F$71,$I$2)<2)*(LEN($I$2)=LEN($F$2:$F$71)),SUBSTITUTE($F$2:$F$71,$I$2,""),IF((COUNTIF($F$2:$F$71,$I$5)<2)*(COUNTIF($F$2:$F$71,$I$2)<2)*(LEN($I$2)=LEN($F$2:$F$71))*(LEN($I$5)=LEN($F$2:$F$71)),SUBSTITUTE(SUBSTITUTE($F$2:$F$71,$I$5,""),$I$2,""),$F$2:$F$71&"")))),0)),ROW($1:$26)),ROWS($2:2)),"")

+ 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. [SOLVED] Compare two columns on separate sheet, if missing, insert missing data
    By lilvictorians in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 04-03-2019, 11:44 PM
  2. [SOLVED] Determine the missing numbers
    By coach.32 in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 08-10-2014, 07:08 PM
  3. compare two similar lists to determine what is missing
    By oshodibo in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-29-2014, 03:43 AM
  4. Loop through columns determine if autofiltered
    By randell.graybill in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-14-2012, 10:35 PM
  5. Determine if columns exist
    By strippy in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 04-19-2011, 09:44 AM
  6. Determine columns used
    By Jane Wee in forum Excel - New Users/Basics
    Replies: 3
    Last Post: 11-08-2005, 12:20 AM
  7. Determine last row then sum various columns by row
    By SystemSource in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-18-2005, 04:34 PM

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