Returning Filtered results

Happyo

New Member
Joined
Apr 29, 2019
Messages
4
Hi All,
i am trying to find a a function that can filter a column of supplier codes (the column will have the supplier code in it between 1-??? times) then return it on a new sheet just once along with the supplier description (adjacent cell) eg:

the source sheet

20935

<tbody>
</tbody>

ABC People

<tbody>
</tbody>
21330AshDown
20935

<tbody>
</tbody>
ABC People

<tbody>
</tbody>
20935

<tbody>
</tbody>
ABC People

<tbody>
</tbody>
20717

<tbody>
</tbody>
Multispares
20717

<tbody>
</tbody>
Multispares

<tbody>
</tbody>



and the result i want is just the supplier listed once on a new sheet
20935

<tbody>
</tbody>
ABC People
21330AshDown
20717Multispares

<tbody>
</tbody>

i hope I have made that clear enough, if not please tell me.
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Hi Happyo,

Welcome to MrExcel!!

Try these seven steps:

1. Filter the dataset as required
2. Highlight (select) the filtered results
3. Press F5 and from the Go To dialog click the Special button
4. From the Go To Special dialog click the Visible cells only radio button and then click OK
5. Press Ctrl + C (i.e. press and hold down the Ctrl button and then press C to get the filtered results pasted onto the clipboard)
6. Right-click on the first cell you want the output to appear and from the shortcut menu select Paste Special
7. Select the desired paste option(s) from the Paste Special dialog and then click OK

Regards,

Robert
 
Upvote 0
Thanks Robert,
I am trying to find a way to automate the process, especially because i can have 1000's of suppliers on any given month and this method gives me the same supplier multiple times, I just want 1 instance of the supplier and supplier code on the next page where my If/then code add's all the costs of that supplier. so basically I am trying to take multiple purchases from X supplier over the month and condense it to X Dollars spent at X supplier.

Hi Happyo,

Welcome to MrExcel!!

Try these seven steps:

1. Filter the dataset as required
2. Highlight (select) the filtered results
3. Press F5 and from the Go To dialog click the Special button
4. From the Go To Special dialog click the Visible cells only radio button and then click OK
5. Press Ctrl + C (i.e. press and hold down the Ctrl button and then press C to get the filtered results pasted onto the clipboard)
6. Right-click on the first cell you want the output to appear and from the shortcut menu select Paste Special
7. Select the desired paste option(s) from the Paste Special dialog and then click OK

Regards,

Robert
 
Upvote 0
This will produce an unique list into Col. A of sheet 'wsSourceSheet' from a full list of entries in Col. A of sheet 'wsOutputSheet':

Code:
Option Explicit
Sub Macro3()

    Dim lngLastRow As Long
    Dim wsSourceSheet As Worksheet
    Dim wsOutputSheet As Worksheet
    
    Application.ScreenUpdating = False
    
    Set wsSourceSheet = Sheets("Sheet1") 'Source sheet name. Change to suit.
    Set wsOutputSheet = Sheets("Sheet2") 'Output sheet name. Change to suit.
    
    With wsSourceSheet
        'Assumes the supplier codes are in A1:A[last row in Col. A] of 'wsSourceSheet'. Change to suit.
        lngLastRow = .Cells(Rows.Count, "A").End(xlUp).Row
        .Range("A1:A" & lngLastRow).Copy Destination:=wsOutputSheet.Range("A1")
        wsOutputSheet.Range("$A$1:$A$" & lngLastRow).RemoveDuplicates Columns:=1, Header:=xlYes
    End With
    
    Set wsSourceSheet = Nothing
    Set wsOutputSheet = Nothing
    
    Application.ScreenUpdating = True

End Sub

Robert
 
Upvote 0
Um... Wow thanks Robert, I'm not sure I understand it but I will give it a go tomorrow..... just have to remember how to do Macro's now.... :eek:

This will produce an unique list into Col. A of sheet 'wsSourceSheet' from a full list of entries in Col. A of sheet 'wsOutputSheet':

Code:
Option Explicit
Sub Macro3()

    Dim lngLastRow As Long
    Dim wsSourceSheet As Worksheet
    Dim wsOutputSheet As Worksheet
    
    Application.ScreenUpdating = False
    
    Set wsSourceSheet = Sheets("Sheet1") 'Source sheet name. Change to suit.
    Set wsOutputSheet = Sheets("Sheet2") 'Output sheet name. Change to suit.
    
    With wsSourceSheet
        'Assumes the supplier codes are in A1:A[last row in Col. A] of 'wsSourceSheet'. Change to suit.
        lngLastRow = .Cells(Rows.Count, "A").End(xlUp).Row
        .Range("A1:A" & lngLastRow).Copy Destination:=wsOutputSheet.Range("A1")
        wsOutputSheet.Range("$A$1:$A$" & lngLastRow).RemoveDuplicates Columns:=1, Header:=xlYes
    End With
    
    Set wsSourceSheet = Nothing
    Set wsOutputSheet = Nothing
    
    Application.ScreenUpdating = True

End Sub

Robert
 
Upvote 0
No problem.

You could almost record what you need as I've just coded the Remove Duplicates option from the Data Tools tab within the Data ribbon.
 
Upvote 0
That’s good as that’s the environment I coded the solution in ?
 
Upvote 0

Forum statistics

Threads
1,214,651
Messages
6,120,744
Members
448,989
Latest member
mariah3

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