Create a list on multiple criteria from a dynamic master sheet

Dee Dee

New Member
Joined
Sep 18, 2020
Messages
20
Office Version
  1. 365
Platform
  1. Windows
Hi,

I have a question that I am not sure if I am explaining right. I have a full database of information and I want to make a new sheet with a list off of that database carrying over three columns of information IF one other column in the database indicates Yes. I somehow cannot think of how to ask the question to be able to look for the answer. Any assistance would be appreciated. Clarification is probably needed I know.
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Welcome DeeDee. Suggest you upload a sample data file that is representative of your actual data. Use XL2BB to upload that information. It does not need to be a lot of records 8-10 will generally suffice. Look at my signature block for instructions on how to employ XL2BB
 
Upvote 0
test keta.xlsx
ABCDEFGHIJKLM
1ICOMPLAINTS #AGGRIEVED PERSONCOMMISSARY/HQEMPLOYMENT STATUSINITIAL CONTACT DATEASSIGNED COUNSELORBASIS(ES)ISSUE(S)HARASSMENT ALLEGED (Y/N)?HARSSMENT QUESTIONS ISSUED (Y/N)?DATE OF MOST RECENT ALLEGED ACTDATE OF CLOSUREPrevious Counseling (Y/N)
2James Brownbottleunemployed8/1/20y
3Lucille Ballcaresecretary1/2/20y
4Michael Jordanshoehoe3/4/20y
5Mickey Mouseslipperdealer9/2/20n
6George Jeffersondopedoctor12/1/19n
7Louise Jeffersoncanthief11/7/19y
8JJ Walkermatcarpenter3/2/18y
9Jane Doewarlaithworker9/30/19y
10Captain Ahabdogstevedore9/30/18n
Contacts (No counseling)
Cells with Data Validation
CellAllowCriteria
I1:J10List='[Complaints Tracker - FY21.xlsx]DropDown'!#REF!
F1:F10List='[Complaints Tracker - FY21.xlsx]DropDown'!#REF!
D1,D11:D1048576List='[Complaints Tracker - FY21.xlsx]DropDown'!#REF!
 
Upvote 0
I would need to make a list in another sheet with columns B, C, D, and E copied over IF column M is "Y".
 
Upvote 0
VBA solution:

VBA Code:
Option Explicit

Sub DD()
    Dim s1 As Worksheet, s2 As Worksheet
    Dim i As Long, lr As Long, lr2 As Long
    Set s1 = Sheets("Sheet1")
    Set s2 = Sheets("Sheet2")
    lr = s1.Range("B" & Rows.Count).End(xlUp).Row
    Application.ScreenUpdating = False
    For i = 2 To lr
        If s1.Range("M" & i) = "y" Then    'Note VBA is case sensitive
            lr2 = s2.Range("A" & Rows.Count).End(xlUp).Row
            s1.Range("B" & i & ":E" & i).Copy
            s2.Range("A" & lr2 + 1).PasteSpecial xlPasteValues
        End If
    Next i
    Application.CutCopyMode = False
    Application.ScreenUpdating = True
    MsgBox "complete"

End Sub

Standard Module
How to install your new code
Copy the Excel VBA code
Select the workbook in which you want to store the Excel VBA code
Press Alt+F11 to open the Visual Basic Editor
Choose Insert > Module
Edit > Paste the macro into the module that appeared
Close the VBEditor
Save your workbook (Excel 2007+ select a macro-enabled file format, like *.xlsm)

To run the Excel VBA code:
Press Alt-F8 to open the macro list
Select a macro in the list
Click the Run button
 
Upvote 0
I didn't get it to work. I copied from first to the last line of the code, was that right? Or was I to leave the option and end lines out?
 
Upvote 0
How about a formula
+Fluff New.xlsm
ABCDE
1AGGRIEVED PERSONCOMMISSARY/HQEMPLOYMENT STATUSINITIAL CONTACT DATE
2James Brownbottleunemployed01/08/2020
3Lucille Ballcaresecretary02/01/2020
4Michael Jordanshoetailor04/03/2020
5Louise Jeffersoncanthief07/11/2019
6JJ Walkermatcarpenter02/03/2018
7Jane Doewarlaithworker30/09/2019
8
9
10
Sheet2
Cell Formulas
RangeFormula
A2:D7A2=FILTER(Sheet1!B2:E100,Sheet1!M2:M100="y")
Dynamic array formulas.
 
Upvote 0
How about a formula
+Fluff New.xlsm
ABCDE
1AGGRIEVED PERSONCOMMISSARY/HQEMPLOYMENT STATUSINITIAL CONTACT DATE
2James Brownbottleunemployed01/08/2020
3Lucille Ballcaresecretary02/01/2020
4Michael Jordanshoetailor04/03/2020
5Louise Jeffersoncanthief07/11/2019
6JJ Walkermatcarpenter02/03/2018
7Jane Doewarlaithworker30/09/2019
8
9
10
Sheet2
Cell Formulas
RangeFormula
A2:D7A2=FILTER(Sheet1!B2:E100,Sheet1!M2:M100="y")
Dynamic array formulas.
This one says that the "function isn't valid". I would really appreciate if the formula can work because I am not very confident with the VBA
 
Upvote 0
Ok, that means you don't have the latest update yet. Try
Cell Formulas
RangeFormula
A2:D10A2=IFERROR(INDEX(Sheet1!B$2:B$100,AGGREGATE(15,6,(ROW(Sheet1!$M$2:$M$100)-ROW(Sheet1!$M$2)+1)/(Sheet1!$M$2:$M$100="y"),ROWS(A$2:A2))),"")
 
Upvote 0
Cannot determine what is wrong in your situation. It worked perfectly with the data you provided. Do you have a second tab named "Sheet2"
 
Upvote 0

Forum statistics

Threads
1,215,025
Messages
6,122,732
Members
449,093
Latest member
Mnur

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