Returning Values from a table without gaps

Nytro86

New Member
Joined
Aug 9, 2018
Messages
1
Hello all.
I am trying to reference in a new Tab a list of all the items that hae an "X" against them I.E.

A B
Cats
X
Dogs
ParrotsX
Shrimp
PandasX

<tbody>
</tbody>


instead of getting
Cats
Blank
Parrots
Blank
Pandas


I am trying to get
Cats
Parrots
Panda

I have tried multiple lockups etc, and I am trying to have it so there is no filter/sorting required on the final page

any help is greatly appreciated

Kind regards
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
maybe like this?

Code:
Sub new11()
Dim rowswithX As Range
Dim i As Integer

For i = 1 To 5
If Range("B" & i).Value = "X" Then
If rowswithX Is Nothing Then
            Set rowswithX = Rows(i)
        Else
            Set rowswithX = Union(rowswithX, Rows(i))
        End If
Else
End If
Next i
rowswithX.Copy Destination:=Worksheets("Sheet2").Range("A1")

End Sub

hope that helps
 
Upvote 0
You can adapt the formula in C1 to enter it from a new tab. Copy it down to cover the list in col A.

Note the formula must be confirmed using ctrl+shift+enter.
Excel Workbook
ABC
1CatsXCats
2DogsParrots
3ParrotsXPandas
4Shrimp
5PandasX
Sheet8
 
Upvote 0
Similar to JoeMo's but if you prefer without the Ctrl+Shift+Enter

Excel Workbook
ABC
1CatsXCats
2DogsParrots
3ParrotsXPandas
4Shrimp
5PandasX
6
List
 
Upvote 0

Forum statistics

Threads
1,215,420
Messages
6,124,802
Members
449,190
Latest member
cindykay

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