Copy paste from sheet 1 to sheet 2 when row 1 value matches

jelmer123456

New Member
Joined
Mar 3, 2021
Messages
11
Office Version
  1. 365
Platform
  1. Windows
Hi, im trying to find a solution to my problem

1614781531337.png
1614782044350.png

I'm trying to copy the data from picture 1 to picture 2 , but only when the value on row 1 matches.
For my work I have to copy paste alot of data. With the particular file im doing right now picture 1 would have data from $A till $DC with ~2300 rows.
$A till $DC and row 1 will always be the same and the amount of rows change per export file.

Picture 2 goes from $A till $AO and all the values on row 1 from match a value from picture 1.
Copying every row by hand makes me go insane as they are in a different order.

I've spend the last 2 hours trying to find a solution but im stuck and looking for help. I checked all the "has this question already been asked" posts that got suggested but that didn't really help.
Any suggestions?
 

jelmer123456

New Member
Joined
Mar 3, 2021
Messages
11
Office Version
  1. 365
Platform
  1. Windows
Thinking about it, a better option would be
Excel Formula:
=LET(Fltr,FILTER(A2:I10,COUNTIF(M1:Q1,A1:I1)),Sorted,SORTBY(FILTER(A2:I10,COUNTIF(M1:Q1,A1:I1)),MATCH(FILTER(A1:I1,COUNTIF(M1:Q1,A1:I1)),M1:Q1,0)),IF(ISBLANK(Sorted),"",Sorted))
In Dutch
Excel Formula:
=LET(Fltr;FILTER(A2:I10;AANTAL.ALS(M1:Q1;A1:I1));Sorted;SORTEREN.OP(FILTER(A2:I10;AANTAL.ALS(M1:Q1;A1:I1));VERGELIJKEN(FILTER(A1:I1;AANTAL.ALS(M1:Q1;A1:I1));M1:Q1;0));ALS(ISLEEG(Sorted);"";Sorted))
It works perfectly, thank you so much!
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.

jelmer123456

New Member
Joined
Mar 3, 2021
Messages
11
Office Version
  1. 365
Platform
  1. Windows
Thinking about it, a better option would be
Excel Formula:
=LET(Fltr,FILTER(A2:I10,COUNTIF(M1:Q1,A1:I1)),Sorted,SORTBY(FILTER(A2:I10,COUNTIF(M1:Q1,A1:I1)),MATCH(FILTER(A1:I1,COUNTIF(M1:Q1,A1:I1)),M1:Q1,0)),IF(ISBLANK(Sorted),"",Sorted))
In Dutch
Excel Formula:
=LET(Fltr;FILTER(A2:I10;AANTAL.ALS(M1:Q1;A1:I1));Sorted;SORTEREN.OP(FILTER(A2:I10;AANTAL.ALS(M1:Q1;A1:I1));VERGELIJKEN(FILTER(A1:I1;AANTAL.ALS(M1:Q1;A1:I1));M1:Q1;0));ALS(ISLEEG(Sorted);"";Sorted))
Hmm, I need help with one more thing. I did it like you and placed the data I need copied in the same sheet. But after that I need it to be its seperate file to import the data. When I copy it doesn't copy it properly and everything is empty when I paste it into a new excel file, which makes sense because the formula is applied to all the cells and it can't find the data when placed in a a new file. Been trying to find a solution but im to much of a beginner to excel I guess.
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
56,647
Office Version
  1. 365
Platform
  1. Windows
It should work across workbooks, as long as you add the workbook name & sheet like
Excel Formula:
=LET(Fltr,FILTER([Book2.xlsx]Sheet1!A2:I10,COUNTIF(M1:Q1,[Book2.xlsx]Sheet1!A1:I1)),Sorted,SORTBY(FILTER([Book2.xlsx]Sheet1!A2:I10,COUNTIF(M1:Q1,[Book2.xlsx]Sheet1!A1:I1)),MATCH(FILTER([Book2.xlsx]Sheet1!A1:I1,COUNTIF(M1:Q1,[Book2.xlsx]Sheet1!A1:I1)),M1:Q1,0)),IF(ISBLANK(Sorted),"",Sorted))
 
Solution

Watch MrExcel Video

Forum statistics

Threads
1,129,752
Messages
5,638,162
Members
417,011
Latest member
Amaden95

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
Top