Creating an Unusual List

j_brubaker

New Member
Joined
Aug 9, 2018
Messages
14
My problem is the following:

I am looking to create a list in 'column A' by referencing a range of cells from the range B2:E20 with some blank cells and some not. In the list I want to include only the non-blank cells while also updating automatically if the cells in 'columns B:E' are changed.

This may only take a simple function that I am unaware of.

Thanks in advance for any help,
Josh
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
What sort of values might occur in B2:E20? (text?, numerical?, dates? errors? mix of text & numbers? etc)
 
Last edited:
Upvote 0
What about
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Intersect(Target, Range("b2:e20")) Is Nothing Then Exit Sub
    [a:a].ClearContents
    x1 = Range("b" & Rows.Count).End(xlUp).Row
    x1 = Filter(Evaluate("transpose(if(countif(offset(b2:b" & x1 & _
                         ",,,row(1:" & x1 & ")),b2:b" & x1 & ")=1,b2:b" & x1 & "))"), False, 0)
    x2 = Application.Max(Range("c" & Rows.Count).End(xlUp).Row, 3)
    x2 = Filter(Evaluate("transpose(if(countif(offset(c2:c" & x2 & _
                         ",,,row(1:" & x2 & ")),c2:c" & x2 & ")=1,c2:c" & x2 & "))"), False, 0)
    x3 = Application.Max(Range("d" & Rows.Count).End(xlUp).Row, 4)
    x3 = Filter(Evaluate("transpose(if(countif(offset(d2:d" & x3 & _
                         ",,,row(1:" & x3 & ")),d2:d" & x3 & ")=1,d2:d" & x3 & "))"), False, 0)
    x4 = Application.Max(Range("e" & Rows.Count).End(xlUp).Row, 5)
    x4 = Filter(Evaluate("transpose(if(countif(offset(e2:e" & x4 & _
                         ",,,row(1:" & x4 & ")),e2:e" & x4 & ")=1,e2:e" & x4 & "))"), False, 0)
    a = Split(Join(x1, Chr(164)) & Chr(164) & Join(x2, Chr(164)) & Chr(164) & Join(x3, Chr(164)) _
            & Chr(164) & Join(x4, Chr(164)), Chr(164))
    Cells(2, 1).Resize(UBound(a)) = Application.Transpose(a)
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,391
Messages
6,124,673
Members
449,178
Latest member
Emilou

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