Find Values that Match Criteria from Different Sheet and Copy over to Another

glaccounting

New Member
Joined
Jan 4, 2024
Messages
2
Office Version
  1. 2016
Platform
  1. Windows
I would like to ask some help. I am very new to VBA and I would really appreciate a lot if you could lend me a hand.

I have 2 Sheets. Output Sheet & Helper Sheet. I want to extract all the values that meets criteria from Helper Sheet, copy all that and paste it to the Output Sheet. And some more additional tasks if you could accommodate.

I would like to copy and paste all the cells from Helper Sheet Column D and Column F over to Output Sheet Column D and G respectively, if OutputSheet Cell D8 & D9 value is equal to the rows of Helper Sheet Column B & C.
After that, I would also like to copy down the formulas in OutputSheet to the last non blank rows of Column D. Notice I already have formulas set up in Cells B13, C13, F13, H13 & I13.
Then paste formulas from another sheet (A1:H4) in that newly created rows.


Here's my the output sheet.
OTC-Sample-Sheet-v19.xlsm
ABCDEFGHIJKL
8Property, Plant and Equipment: AMPLIFIER
9Object Account Code:1-06-05-070-001-000-000
10Account Title:Communication Equipment
11
12DateReferencePO-Contract NumberDescriptionQty.Unit CostTotal CostAccumulated DepreciationAccumulated Impairment LossesIssues/ Transfers/ Adjustment/sAdjusted Cost
13#N/A#N/A00.000.000.00
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35GRAND TOTAL0.000.000.000.000.00
Output
Cell Formulas
RangeFormula
D9D9=VLOOKUP(D8,CHOOSE({1,2},Helper!$B$1:$B$14,Helper!$C$1:$C$14),2,FALSE)
B13B13=VLOOKUP(C13,CHOOSE({1,2},JEV,Tdate),2,FALSE)
C13C13=VLOOKUP($D$8&$D$9&D13,CHOOSE({1,2},Table2[[#All],[Helper]],JEV),2,FALSE)
F13F13=COUNTIFS(TYPE,$D$8,ACCCODE,$D$9,PONUM,D13,COST,G13)
H13H13=+F13*G13
I13I13=SUMIFS(BEGDEP,TYPE,$D$8,ACCCODE,$D$9,PONUM,D13,COST,G13)
L13L13=SUM(L12,H13:K13)
H35:K35H35=SUBTOTAL(9,H13:H34)
L35L35=SUM(H35:K35)
Press CTRL+SHIFT+ENTER to enter array formulas.
Named Ranges
NameRefers ToCells
Data!_FilterDatabase=Data!$A$5:$P$70F13, I13
ACCCODE=Data!$B$5:$B$70F13, I13
BEGDEP=Data!$H$5:$H$70I13
COST=Data!$G$5:$G$70F13, I13
JEV=Data!$D$5:$D$70B13:C13
PONUM=Data!$C$5:$C$70F13, I13
Tdate=Data!$E$5:$E$70B13
TYPE=Data!$A$5:$A$70F13, I13
Cells with Data Validation
CellAllowCriteria
D8List=Helper!$B$1:$B$14


And my Helper Sheet

Cell Formulas
RangeFormula
B4:C13B4=B3
D12:D13,D9:D10,D5:D7D5=D4
E2:E14E2=CONCATENATE(B2,C2,D2)
Press CTRL+SHIFT+ENTER to enter array formulas.
 

Attachments

  • Output After Extracting Values.JPG
    Output After Extracting Values.JPG
    192.5 KB · Views: 18
  • Output Copy Down Formula.JPG
    Output Copy Down Formula.JPG
    178.2 KB · Views: 18
  • Output Insert 4 Rows.JPG
    Output Insert 4 Rows.JPG
    168.7 KB · Views: 20
  • Output Formula Inserted.JPG
    Output Formula Inserted.JPG
    171.5 KB · Views: 16

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().

Forum statistics

Threads
1,223,882
Messages
6,175,164
Members
452,615
Latest member
bogeys2birdies

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