# copy the data based on same total number between 2 sheets

#### reza_doang

##### Board Regular
Hi All -

i hope i can explain it with well

i want to copy data column based on total of number.
let says, I have the master data in sheet 1
and sheet 2, is my working sheet.

- in sheet 2 100200 has 2 line then it will copy the data from master data (sheet 1).
- in sheet 2 100300 has 1 line, while in master has 2 lines, so it will ignore
- in sheet 2 100400 has 1 line, while in master don't have that number, so it will ignore
- in sheet 2 300100 has 3 line, same with in master sheet, has 3 line, so it will copy the number.

based on this sample, is it possible to do that?

Master Data (Sheet 1)
 Numbers Item 100200 1 100200 2 100300 1 100300 2 300100 1 300100 2 300100 3

<tbody>
</tbody>

Working sheet (Sheet 2)

 Numbers Expected result 100200 1 100200 2 100300 NA 100400 NA 300100 1 300100 2 300100 3

<tbody>
</tbody>

regards,
reza

### Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
FORmula in sheet 2 cell B2

=IF(COUNTIF(\$A\$2:\$A\$8,A2)=COUNTIF(Sheet1!\$A\$2:\$A\$8,Sheet2!A2),INDEX(Sheet1!\$B\$2:\$B\$8,AGGREGATE(15,6,ROW(\$A\$2:\$A\$8)-ROW(\$A\$2)+1/(A2=Sheet1!\$A\$2:\$A\$8),COUNTIF(\$A\$2:A2,A2))),"NA")

NOTE:
incress range as your data range

Replies
0
Views
217
Replies
3
Views
339
Replies
3
Views
714
Replies
1
Views
313
Replies
0
Views
245

1,203,683
Messages
6,056,722
Members
444,887
Latest member
cvcc_wt

### 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.

### Which adblocker are you using?

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

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