VBA or Excel to Auto Filter

JMC57

Board Regular
Joined
Apr 24, 2012
Messages
118
I have a list of numbers referencing an item in column B of sheet 2 that can be found in col A sheet1. I want to auto filter column A in Sheet 1 for rows that contain this number in col A Sheet 1. The number can appear multiple times in column A Sheet 1. <o:p></o:p>
I tried VLook up. However, it does not return each occurrence of the number. There are 6000 rows in sheet 1. An item can appear up to 200 times or not at all. <o:p></o:p>
Hopefully someone can help with a VBA code or excel formula to solve this. <o:p></o:p>
Thanks!<o:p></o:p>
 
Sheet 2 Col B

=IF(COUNTIF(Sheet2!$A$1:$A$6000,$A2)>=COLUMNS($B2:B2),INDEX(Sheet2!$B$1:$B$6000,SMALL(IF(Sheet2!$A$1:$A$6000=$A2,ROW(Sheet2!$A$1:$A$6000)-ROW(Sheet2!$A$1)+1),COLUMNS($B2:B2))),"")

Sheet 2 Col C
=IF(COUNTIF(Sheet2!$A$1:$A$6000,$A2)>=COLUMNS($C2:C2),INDEX(Sheet2!$C$1:$C$6000,SMALL(IF(Sheet2!$A$1:$A$6000=$A2,ROW(Sheet2!$A$1:$A$6000)-ROW(Sheet2!$A$1)+1),COLUMNS($C2:C2))),"")
 
Upvote 0

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Did you remember to confirm those formulas with Ctrl+Shift+Enter, not just Enter? If entered correctly Excel will surround them with curly braces {}.
 
Upvote 0

Forum statistics

Threads
1,216,117
Messages
6,128,937
Members
449,480
Latest member
yesitisasport

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