+ Reply to Thread
Results 1 to 13 of 13

Dynamic named range, ignoring duplicates and blanks, WITHOUT VBA

Hybrid View

  1. #1
    Registered User
    Join Date
    04-22-2013
    Location
    Chicago
    MS-Off Ver
    Excel 2010
    Posts
    5

    Dynamic named range, ignoring duplicates and blanks, WITHOUT VBA

    Hi there,
    A month or two ago I found the solution to this problem, but now that I'm tackling it again it seems that the entire internet has forgotten how it's done. I'm hoping that's not the case here.

    I have a very simple problem: I have a table ("Project_Database"), and in that table there are various columns. One of those columns ("Team") has text values. There are duplicates of some of these values (i.e. "Marketing" and "Business Development" come up more than once).

    I want to create a dynamic named range ("Range") from the data in column "Team". I want "Range" to ignore duplicates and ignore blanks. Most importantly I want to do this WITHOUT VBA and WITHOUT helper columns, using only one formula in the Named Range manager.



    Many forum threads I've looked at said this was impossible -- but, given that I pulled it off once in the past, I know for a fact this is not the case. From what I remember the last time I did this: the data in the table column needs to be sorted, so that all repeat instances are clustered together. The formula I used then had some mixture of INDEX, OFFSET, MATCH, though I don't remember exactly what functions and in exactly what order.

    PLEASE ANY HELP WOULD BE SO MUCH APPRECIATED. I see this question asked over and over on google, yet no one has offered up a good solution yet.

  2. #2
    Valued Forum Contributor Lemice's Avatar
    Join Date
    04-13-2013
    Location
    Somewhere.
    MS-Off Ver
    Excel 2016
    Posts
    696

    Re: Dynamic named range, ignoring duplicates and blanks, WITHOUT VBA

    Hello,

    I believe also, that this can be done, I remember reading something about this among the tips and tricks in the attached file in
    http://www.excelforum.com/tips-and-t...e-learned.html
    Also, can you provide a sample file? It will be easier for others to help you also.
    (copy pasta from Ford)
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools

    Regards,
    Lem

  3. #3
    Registered User
    Join Date
    04-22-2013
    Location
    Chicago
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Dynamic named range, ignoring duplicates and blanks, WITHOUT VBA

    Hi Lemice,
    Thanks for your response. I'll search through that Tips & Tricks link you posted, and see if I find a solution there. If so, I'll post it here.

    Attached is a basic example of what I'm discussing above (I can't attach the exact spreadsheet because it's work sensitive). One table, one column, one validation, many values.

    Any thoughts?

    Book1.xlsx

  4. #4
    Valued Forum Contributor Lemice's Avatar
    Join Date
    04-13-2013
    Location
    Somewhere.
    MS-Off Ver
    Excel 2016
    Posts
    696

    Re: Dynamic named range, ignoring duplicates and blanks, WITHOUT VBA

    Basing only on Tip no.2 (You can see it on worksheet "2"), you can do this.
    I used the formula in the Tips and Tricks, and change some Cell Reference, and this is what I got. See attached file.
    To avoid error, I put an IFERROR in front of it.
    Attached Files Attached Files

  5. #5
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Dynamic named range, ignoring duplicates and blanks, WITHOUT VBA

    Quote Originally Posted by aimanti View Post
    Most importantly I want to do this WITHOUT VBA and WITHOUT helper columns, using only one formula in the Named Range manager.
    Can't be done that way.

    Without using VBA you would have to use formulas to extract the unique items to another range and then use that other range for whatever.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  6. #6
    Registered User
    Join Date
    04-22-2013
    Location
    Chicago
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Dynamic named range, ignoring duplicates and blanks, WITHOUT VBA

    Hi Tony -- thanks for your response, but I have to humbly disagree. There is a way of reaching this goal without VBA. I know for a fact because I've seen it done myself.

    Let me try phrasing the question another way: I want a data validation list in $A$1 that is based off of an existing list or named range. But I don't want to show any duplicates in that validation list. And I don't want to use helper columns or VBA.

    Again, I know that this is possible. Hopefully someone here knows how to solve it

  7. #7
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Dynamic named range, ignoring duplicates and blanks, WITHOUT VBA

    I'm willing to bet you any amount of money (that you can afford to lose!) that this can not be done without using VBA without using a "helper" column to first extract the unique items.

    Name your amount!

  8. #8
    Valued Forum Contributor Lemice's Avatar
    Join Date
    04-13-2013
    Location
    Somewhere.
    MS-Off Ver
    Excel 2016
    Posts
    696

    Re: Dynamic named range, ignoring duplicates and blanks, WITHOUT VBA

    Please check the post #4 for a sample file. I think it answers your question.

  9. #9
    Registered User
    Join Date
    04-22-2013
    Location
    Chicago
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Dynamic named range, ignoring duplicates and blanks, WITHOUT VBA

    Tony, I appreciate your chutzpah. Could you explain why it's impossible?

    Lemice -- it took a bit of playing around for me to understand the formula you used in the approach and how it worked within the array, but I see how it would be useful (indeed, the key) to building a helper column for a dynamic range. A follow-up question for you, which could help keep data management as clean as possible:

    Is there a way to use your (Lemice's) approach, but put the results in a column within the Table instead? Ideally, the results would automatically populate at the top of the table column rather than being "bumped" one row down as they currently are. I don't know if this would be possible, but would make data management easier on my end.

    Thanks again for your help, guys (or gals). It's much appreciated

  10. #10
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Dynamic named range, ignoring duplicates and blanks, WITHOUT VBA

    Quote Originally Posted by aimanti View Post
    Could you explain why it's impossible?
    Because there isn't a single formula that will return the complete array of unique items (without empty elements).

    Trust me, I've been doing this "stuff" for many years!

  11. #11
    Valued Forum Contributor Lemice's Avatar
    Join Date
    04-13-2013
    Location
    Somewhere.
    MS-Off Ver
    Excel 2016
    Posts
    696

    Re: Dynamic named range, ignoring duplicates and blanks, WITHOUT VBA

    You mean something like this?
    Attached Files Attached Files

  12. #12
    Registered User
    Join Date
    04-22-2013
    Location
    Chicago
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Dynamic named range, ignoring duplicates and blanks, WITHOUT VBA

    Fair enough -- that does get to the basic idea of what I'm looking for. Another question, though one that's less functionally important: is there a way to change the syntax of the function to reflect the Table and Column names? For example, the formula currently includes:

    Formula: copy to clipboard
    =IFERROR(INDEX($J$3:$J$9,MATCH(0,COUNTIF($N$2:N8,$J$3:$J$9),0)),"")


    I know that I can at least do this much to the formula, and get the same result:

    Formula: copy to clipboard
    =IFERROR(INDEX(Project_Database[Team],MATCH(0,COUNTIF($N$2:N2,Project_Database[Team]),0)),"")


    Is there a way to change the syntax of the $N$2:N2 range so that it uses the same Table format? I'm asking for two reasons: (a) I need to make this spreadsheet "fool proof" (i.e. boss proof), and thus need to make all formulas as easily readable as they can be, and (b) to more thoroughly understand your approach.



    [EDIT: I didn't see Tony's previous post before I wrote this in my response:]


    I'm still open to any takers who think they can solve the original question. I think this is a case like the famous "unsolvable statistics problem" -- using regular lines of thinking we might not arrive at the answer, but with some fancy footwork we can solve what we once thought to be unsolvable.

    Otherwise, I'd love to hear an explanation/description of why it's impossible. Does it have to do with the way that ranges look up data, store it, etc? Genuinely curious, as I think it would help expand my understanding (and anyone else who is pursuing the same question, which I've seen asked in a number of places).
    Last edited by aimanti; 04-23-2013 at 05:58 PM.

  13. #13
    Valued Forum Contributor Lemice's Avatar
    Join Date
    04-13-2013
    Location
    Somewhere.
    MS-Off Ver
    Excel 2016
    Posts
    696

    Re: Dynamic named range, ignoring duplicates and blanks, WITHOUT VBA

    The $N$2:$N2 part is used to exclude any duplicated results. The formula is trying to match 0 with the COUNTIF of all possible results among the already found result, which is $N$2:$N2 in the attach file in post #10.
    This range will vary largely depending on where the formula is placed, say in Column X row 3 then it will become $X$2:$X2; column Y row 10 then it will be $Y$9:$Y9.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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