How to Only Show Rows That Match Specific Data

jacom

New Member
Joined
Apr 21, 2011
Messages
2
Hi-- I'm a newbie and a first time poster. Thank you for considering helping me.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>
<o:p></o:p>
Here's the problem:<o:p></o:p>
<o:p></o:p>
Workbook #1 has a single column of account numbers- about 16,000 unique records.<o:p></o:p>
<o:p></o:p>
In Workbook #2, each row/record has multiple columns of data (account number, name, address, etc.). This workbook has about 25,000 rows- of which some or all of 16,000 account numbers from Workbook #1 appear.

I'm looking for a way to ONLY show the rows/records in Workbook #2 (based on account number) that appear in Workbook #1 and hide the rest.<o:p></o:p>

Thanks so much!
Mark...
 
Last edited:

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
Hi Mark,

Welcome to MrExcel.

When you say Workbook 1 & Workbook 2 do you really mean 2 separate Workbooks or 2 sheets within the same Workbook?

If you have 2 separate Workbooks then you will need add a helper column and then count if the value in Workbook2 is in Workbook1, something like this.....

=SUMPRODUCT(--(('C:\Documents and Settings\Ak\Desktop\[Workbook1.xls]Sheet1'!$A$2:$A$20)=A2))

Change this Sheet1'!$A$2:$A$20 to suit your sheet name and range in Workbook1
Change this =A2 to suit the first cell in Workbook2 with the Account Number in.
You will need to put the full file path, this will work when Workbook1 is closed.

Next you will need some VBA code in Workbook2 to hide the rows that = 0..

Code:
Sub HideRows()
On Error Resume Next
With Range("E2:E800") 'Your Helper Column, change the range to suit yours
.EntireRow.Hidden = False
For i = 1 To .Rows.Count
If WorksheetFunction.Sum(.Rows(i)) = 0 Then
.Rows(i).EntireRow.Hidden = True
End If
Next i
End With
End Sub

Take a look here.....
http://www.mrexcel.com/archive/VBA/8558d.html
http://www.mrexcel.com/forum/showthread.php?t=544052

Good luck, I hope this helps to point you in the right direction.
If nothing here is of use to you, it has at least bumped you back up!

Ak
 
Last edited:
Upvote 0
Thank you very much. I'm not very experienced with VB, but I'll give this a shot and post my results.

I appreciate you taking the time to help!
Mark...
 
Upvote 0

Forum statistics

Threads
1,224,595
Messages
6,179,798
Members
452,943
Latest member
Newbie4296

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