Advanced Formula Challenge #6: Occurs once, non-contiguous range 9

The challenge this week is as follows: given a non-contiguous range, made up of an arbitrary number of single-column ranges, the values in each of which being either a numeric, text or null string, to generate a list, in numerical order and beginning in A2, of all numbers which occur precisely once within that range.

For example, in the below:

Occur Once Non-Contiguous Ranges

three numbers – 1, 2 and 9 – occur precisely once across the non-contiguous, union range defined by:


(You can download the file here.)

As usual, the formula in A2, when copied down, is to produce a blank in cells beyond the expected number of returns. What’s more, this is to be done via reference to another formula in A1, also to be derived, and whose value is equal to that expected number of returns. In this example that value is 3.

As such, the formula in A2 is to begin with:


Also note that, even though the other cells in the range C1:N12 are empty in this example, this cannot be assumed to always be the case. In fact, solvers should assume that there may be numericals within those other cells as well.

Solution next week. Best of luck!


  1. For A1:


    A2 and copy down:







    Maybe I misunderstood your requirements?


  2. Apologies – my fault for not being so clear.

    Your second solution is not viable, as I should’ve mentioned that the other cells in C1:N12 could contain numericals which are not to be returned (otherwise it would kind of defeat the point of the non-contiguous range bit, wouldn’t it!).

    And I completely forgot to mention that the returns should be in numerical order.

    I will add both to the thread now.

    Also, you may want to store that union range as a Defined Name?

    But no, in general I don’t think you have misunderstood my requirements.

  3. named range ‘Range_NC’ is


    then count is

  4. Very good, Cyril, and precisely what I used, though of course there are several alternatives available, such as the SUMPRODUCT version used by Bill, which is also perfectly good (although the ROW(1:10) construction is perhaps a touch “static”).

    That’s the count. What about the main formula?

  5. Hi XOR LX!

    Create a Defined Name RNG with the data.

    For the count:


    And the Extract Formula in A2 (Confirm CSE):


    Another Option Can be (without CSE):



  6. Good to see you again, John!

    And I can’t fault that solution whatsoever. Great stuff and well done!

    (Nice of you to throw in a non-array version as well. I always wonder at which point over the next few years we’re going to start assuming as default that the majority of users have Excel 2010, and so we can start including the under-employed AGGREGATE in more of our solutions.)

    Thanks a lot.

  7. Nothing much to add.

    use Named range Val_cnt described numerous times in your other challenges:


    And in A2, CSE:


    PS: Using Excel for MAC so NOT everyone is using Excel 2010… 🙂

    Now what interested me was to return as well the text part AND the integers but in ascending order.

  8. Great stuff, Cyril. A slightly different approach towards constructing the bins_array, but equally good.

    This demonstrates the flexibility we have here with regards to this parameter. Although in this particular case we don’t actually need to define it so precisely (In fact, Bill’s ROW(1:10)-1 will work just fine, although we should probably put an INDIRECT in to make it immune to row insertions), it’s nevertheless good practice to do so, as we may find ourselves in situations where such rigour is in fact required.

    Sorry – I should’ve subtitled this site (Non-Mac) Advanced Excel Techniques… 🙂

    Interesting other query as well. What “order” exists for numerics and text, though? Is “a” before 1?

  9. 1- “Non -MAC”… Alas I shall remain a lone macexceler… hehehe
    2- Maybe text first then integers although the other way around is not an issue…
    so either:
    Now, thinking of it, maybe the second would make more sense?

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s