Conditional Inclusion of Text in a Column

expos4ever

New Member
Joined
Jun 26, 2015
Messages
38
This is the kind of thing I am trying to do:

1. I will enter the names of people in column A of Sheet 1.
2. In column B of Sheet 1, I will implement a checklist with two options - Yes and No
3. I will select Yes for each person whose name I want to have appear in another column-based list that I want to appear on Sheet 2. Of course, I want the list on Sheet 2 to not have any "holes" (empty cells).

Example (note: I can't figure out the alignment in what follows - but there are two columns in sheet 1):

Sheet 1:
A B

Fred Yes
Jane No
Julian No
Lucy Yes

Sheet 2
A
Fred
Lucy

Note how there are not blank cells for Jane and Julian.

Any suggestions welcomed.
 
Last edited:

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
I think the most efficient way to do this is as follows:
Create a data validation drop down list in column B of Sheet1 which includes "Yes" and "No".
Copy and paste this macro into the worksheet code module. Do the following: right click the tab for your Sheet1 and click 'View Code'. Paste the macro into the empty code window that opens up. Close the code window to return to your sheet. Make a selection in the drop down in columns B and if you select "Yes", the name in column A will be automatically entered in Sheet2.
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Intersect(Target, Range("B:B")) Is Nothing Then Exit Sub
    Application.ScreenUpdating = False
    If Target = "Yes" Then
        Sheets("Sheet2").Cells(Rows.Count, "A").End(xlUp).Offset(1, 0) = Target.Offset(0, -1)
    End If
    Application.ScreenUpdating = True
End Sub
 
Upvote 0
Thanks mumps. However, when I follow your instructions, the list of "selected" names does not appear on Sheet 2; instead, the selected names are appended to the list of names on Sheet1 with sheet 2 entirely unaffected (it remains completely blank).

Actually, I decided to reverse sheets 1 and 2, but I have been careful to account for this (I changed Sheet2 to Sheet1 in the macro, and I pasted the macro into Sheet 2). However, the preceding paragraph is written as though I had not reversed things. Hope that is not too confusing.
 
Last edited:
Upvote 0
Click here to download a sample file so you can see how it works. Just select "Yes" in column B of Sheet1.
 
Upvote 0
Click here to download a sample file so you can see how it works. Just select "Yes" in column B of Sheet1.
I found another way to achieve the desired functionality (using INDEX, ROW, and SMALL functions; however, I very much appreciate your assistance.
 
Upvote 0

Forum statistics

Threads
1,223,902
Messages
6,175,278
Members
452,629
Latest member
SahilPolekar

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