How to autofill a table from Sheet 1 to Sheet 2 based on a condition?

keyri

New Member
Joined
Aug 22, 2018
Messages
1
On the same workbook, I have Sheet 1 and Sheet 2. Sheet 1 is the master list where all business gathered go into the database with the respective towns and has 6 columns. Sheet 2 is an individualized town report where A1 will have the Town name.

Sheet 1
master.PNG


Sheet 2
town.PNG



I would like to create a macro where any row information with that town name from sheet 1 will automatically transfer to sheet 2 making sure it does not repeat. I don't know how to do it.

Can anyone help?

Thanks
Keyri
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Hello Keyri,

If I understand correctly you do need to return many values from your 'Town' lookup ...

I would suggest to start your report in Sheet 2 in cell B2 and use following Array formula :

Code:
[TABLE="width: 84"]
<tbody>[TR]
  [TD="class: xl63, width: 84"]IF(ROWS(B$2:B2)<=COUNTIF(Sheet1!$A$2:$A$21,$A$1),INDEX(Sheet1!$B$2:$B$21,SMALL(IF(Sheet1!$A$2:$A$21=$A$1,ROW(Sheet1!$A$2:$A$21)-ROW(Sheet1!$A$2)+1),ROWS(B$2:B2))),"")[/TD]
[/TR]
</tbody>[/TABLE]

In order to enter this formula ... you need to use simultaneously the 3 keys Control Shift Enter ... instead of the standard Enter key ...

Then ... you can copy down this formula ... in order to get all the Business Names which share the same town selected in cell A1 ...

Hope this will help
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,183
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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