Combine 2 (or more) named ranges into one continous named range

mc-lemons

New Member
Joined
Apr 30, 2012
Messages
49
Office Version
  1. 365
Platform
  1. Windows
Hi all,

I have searched the forum and the internet, but I’m not finding the solution I’m after. I feel that one of you experts know of a way to do this. I am trying to do this without VBA.

Let’s say I have 2 dynamic named ranges: Range1 and Range2.

And at this point in time, this is what the ranges contain:

Range1
Range2
a
g
d
h
c
i
d
j
e
k
f
l

<tbody>
</tbody>

Since both ranges are dynamic, the data above could change at anytime, of course. But I needed somewhere to start for this example.

I want to created a third named range, let’s call it Range1&2 (which would inherently be dynamic as well, since Range1 & Range2 are dynamic).

Range1&2 would then contain the following data:

Range1&2
a
d
c
d
e
f
g
h
i
j
k
L


<tbody>
</tbody>
Range1&2 could then be used for Data Validation lists, with the index, count, sum functions, etc.

I found these two methods at get-digital-help which essentially accomplish what I’m after:

First there is this one (Merge two columns into one list in excel | Get Digital Help - Microsoft Excel resource ):

=IFERROR(INDEX(List1, ROWS(C1:$C$1)), IFERROR(INDEX(List2, ROWS(C1:$C$1)-ROWS(List1)), ""))

Or this one, which is cool because it eliminates blanks (Merge two columns with possible blank cells in excel (formula) | Get Digital Help - Microsoft Excel resource):

=IFERROR(INDEX(List1, SMALL(IF(ISBLANK(List1), "", ROW(List1)-MIN(ROW(List1))+1), ROW(A1))), IFERROR(INDEX(List2, SMALL(IF(ISBLANK(List2), "", ROW(List2)-MIN(ROW(List2))+1), ROW(A1)-SUMPRODUCT(--NOT((ISBLANK(List1)))))), ""))


Note: both are array formulas.


The problem with these is that they only work when input into a cell, and then dragged down. I was looking for method to do this inside a named range, without using any cells. Maybe there is way to adjust the formulas above to do the same. Also, I figured if this could be solved, that any number of named rnages could be combined (I may need to do this shortly down the road)

I’m open to all suggestions and thanks for looking!
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
see the sample sheet
Excel Workbook
AB
1ah
2sj
3dk
4fl
5gp
Sheet1




see validation is effected on range F1 to F10 by this macro (I did not understand the formula)



Code:
Sub test()
Range("F1").EntireColumn.Cells.Clear
Range("D1").EntireColumn.Cells.Clear
Range(Range("A1"), Range("A1").End(xlDown)).Name = "range1"
Range(Range("B1"), Range("B1").End(xlDown)).Name = "range2"






Range("range1").Copy Range("d1")
Range("range2").Copy Range("D1").End(xlDown).Offset(1, 0)


Range(Range("D1"), Range("D1").End(xlDown)).Name = "range3"


'MsgBox Range("range3").Address


Range("F1").Validation.Delete
    With Range("F1:F10").Validation
        .Add Type:=xlValidateList, Formula1:="=range3"
        .IgnoreBlank = True
        .InCellDropdown = True
        .InputTitle = ""
        .ErrorTitle = ""
        .InputMessage = ""
        .ErrorMessage = ""
        .ShowInput = True
        .ShowError = True
    End With
End Sub
 
Upvote 0
Thanks for taking the time to work out a solution.

However, I am after something a little different. I'm not sure if you noticed on the original post, but I'm after a non-VBA solution (I might not be able to utilize VBA for this project, so I was trying to stay clear to avoid any issues down the road).

I actually already have the formulas worked out to make the first two named ranges dynamic, so that is already figured out. I was more or less just giving some background on the setup when I brought up the dynamic named ranges, so that everyone got a good picture of what is going on.

Also, I want the combined data list (what you called "range3") to be combined only in a named range (i.e. i don't want the combined list to show up in any cells).

I found in my searches the suggestion to put in Range3's "Refers to" box: =Range1,Range2

Say Range1 =$A$1:$A$5

and Range2= $B$1:$B$5

Then back in the Name Manger dialog, if you select Range3 and then click the cursor down in the Refer's box, you do indeed see both Range1 *& Range2 highlighted on screen. However, if you then try to create a drop down data validation list from Range3, it won't work.

So the above suggestion for combining ranges doesn't work for my needs.
 
Upvote 0

Forum statistics

Threads
1,214,649
Messages
6,120,728
Members
448,987
Latest member
marion_davis

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top