Pull some rows from one worksheet and compile into another

Steven975

New Member
Joined
Nov 14, 2019
Messages
20
I'm looking for a way to automatically take anything with the status "Pending" and compile a list of them on a seperate another worksheet. Any help is much appreciated!

Worksheet One (INPUT)
NameAmountStatus
John150,000Approved
Chris350,000Pending
Steven215,000Funded
Shawn320,000Pending
James125,000Funded

Worksheet Two (OUTPUT)
Chris350,000Pending
Shawn320,000Pending
 

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
Sheet 2:
COLUMN A
VBA Code:
=IFERROR(INDEX(Sheet1!$A$2:$A$100,AGGREGATE(15,6,(ROW(Sheet1!$C$2:$C$100)-1)/(Sheet1!$C$2:$C$100="PENDING"),ROWS(Sheet1!$C$2:$C2))),"")

COLUMN B
Code:
=IFERROR(INDEX(Sheet1!$B$2:$B$100,AGGREGATE(15,6,(ROW(Sheet1!$C$2:$C$100)-1)/(Sheet1!$C$2:$C$100="PENDING"),ROWS(Sheet1!$C$2:$C2))),"")

COLUMN C
Code:
=IFERROR(INDEX(Sheet1!$C$2:$C$100,AGGREGATE(15,6,(ROW(Sheet1!$C$2:$C$100)-1)/(Sheet1!$C$2:$C$100="PENDING"),ROWS(Sheet1!$C$2:$C2))),"")
 
Upvote 0
Setup like this you can choose a status, and should work well for large data sets.

Book1
ABCDEFGHIJ
1NameAmountStatusTestPendingCriteriaApprovedFundingPending
2Chris350,000Pending
3Shawn320,000Pending
OUTPUT
Cell Formulas
RangeFormula
A2A2{=IF(ROWS($A$2:A2)>COUNTIF(INPUT!$C$2:$C$6,OUTPUT!$F$1),"",INDEX(INPUT!A$2:A$6,SMALL(IF(INPUT!$C$2:$C$6=OUTPUT!$F$1,ROW(INPUT!A$2:A$6)-ROW(INPUT!A$2)+1),ROWS($A$2:A2))))}
Press CTRL+SHIFT+ENTER to enter array formulas surrounded with curly braces.
Cells with Data Validation
CellAllowCriteria
F1List=$H$1:$J$1
 
Upvote 0
Now it looks like I will need to pull from multiple Worksheets to compile this list. Will these techniques still apply?
 
Upvote 0
Yes it's possible but requires more setup. How many sheets are you extracting from?
 
Upvote 0
I've achieved it with 4 sheets but 20 sheets would be better with a VBA option. I can't assist with VBA for this scenario.
 
Upvote 0
There will be 20 or so?
For a vba approach try this. I have assumed that the results go on an existing sheet called 'Summary' (change the code to suit your results sheet name) and that those results will appear below any existing data in column A of that Summary sheet. Test in a copy of your workbook.

VBA Code:
Sub Status_Summary()
  Dim ws As Worksheet
  Dim a As Variant, b As Variant
  Dim i As Long, k As Long
 
  Const StatusOfInterest As String = "Pending" '<- Could change this to Approved etc
 
  For Each ws In Worksheets
    If ws.Name <> "Summary" Then
      a = ws.Range("A2", ws.Range("C" & ws.Rows.Count).End(xlUp)).Value
      ReDim b(1 To UBound(a), 1 To 3)
      k = 0
      For i = 1 To UBound(a)
        If a(i, 3) = StatusOfInterest Then
          k = k + 1
          b(k, 1) = a(i, 1): b(k, 2) = a(i, 2): b(k, 3) = StatusOfInterest
        End If
      Next i
      If k > 0 Then Sheets("Summary").Range("A" & Rows.Count).End(xlUp).Offset(1).Resize(k, 3).Value = b
    End If
  Next ws
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,731
Messages
6,126,537
Members
449,316
Latest member
sravya

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