+ Reply to Thread
Results 1 to 4 of 4

filtering exact match figures with opposite sign

  1. #1
    Registered User
    Join Date
    01-22-2017
    Location
    Malaysia
    MS-Off Ver
    Excel 2013
    Posts
    3

    Question filtering exact match figures with opposite sign

    Hi, I am a new user of excel to be truth. I am still learning how to use the macro function. hope that you guys can help me solve my problem that I am currently having.

    So lets say I have a huge data and in that specific one column in the data will have few numbers that have the exact figures but they have different signs. and I only need numbers in that one column to match with each other and filter them together.

    For example in that specific column:

    100
    23
    56
    -100
    -23
    -56

    and I want it to be like this :

    100
    -100
    23
    -23
    56
    -56

    How can I create a macro that can filter the numbers to match it together and bring along with the whole row as well?

  2. #2
    Valued Forum Contributor
    Join Date
    12-22-2015
    Location
    HK
    MS-Off Ver
    2010
    Posts
    532

    Re: filtering exact match figures with opposite sign

    it better to use a helper column beside at that specific column and use formula =abs(rc[-1]), then run sort

  3. #3
    Registered User
    Join Date
    01-22-2017
    Location
    Malaysia
    MS-Off Ver
    Excel 2013
    Posts
    3

    Re: filtering exact match figures with opposite sign

    well yah indeed that is true. It is much easier to make up another column of it.

    btw, how to ensure that the sorting column can sort any amount of data? because now currently the range is on specific to what I did during sorting.

    PHP Code: 
    Sub Macro5()
    '
    Macro5 Macro
    '

    '
        
    Range("S2").Select
        ActiveCell
    .FormulaR1C1 "=ABS(RC[-5])"
        
    Range("S2").Select
        Selection
    .AutoFill Destination:=Range("S2:S27")
        
    Range("S2:S27").Select
        Columns
    ("S:S").Select
        ActiveWorkbook
    .Worksheets("Sheet3").Sort.SortFields.Clear
        ActiveWorkbook
    .Worksheets("Sheet3").Sort.SortFields.Add Key:=Range_
            
    "S2:S100005"), SortOn:=xlSortOnValuesOrder:=xlAscendingDataOption:= _
            xlSortNormal
        With ActiveWorkbook
    .Worksheets("Sheet3").Sort
            
    .SetRange Range("A1:S100005")
            .
    Header xlYes
            
    .MatchCase False
            
    .Orientation xlTopToBottom
            
    .SortMethod xlPinYin
            
    .Apply
        End With
    End Sub 

  4. #4
    Registered User
    Join Date
    01-22-2017
    Location
    Malaysia
    MS-Off Ver
    Excel 2013
    Posts
    3

    Re: filtering exact match figures with opposite sign

    well yah indeed that is true. It is much easier to make up another column of it.

    btw, how to ensure that the sorting column can sort any amount of data? because now currently the range is on specific to what I did during sorting.

    PHP Code: 
    Sub Macro5()
    '
    Macro5 Macro
    '

    '
        
    Range("S2").Select
        ActiveCell
    .FormulaR1C1 "=ABS(RC[-5])"
        
    Range("S2").Select
        Selection
    .AutoFill Destination:=Range("S2:S27")
        
    Range("S2:S27").Select
        Columns
    ("S:S").Select
        ActiveWorkbook
    .Worksheets("Sheet3").Sort.SortFields.Clear
        ActiveWorkbook
    .Worksheets("Sheet3").Sort.SortFields.Add Key:=Range_
            
    "S2:S100005"), SortOn:=xlSortOnValuesOrder:=xlAscendingDataOption:= _
            xlSortNormal
        With ActiveWorkbook
    .Worksheets("Sheet3").Sort
            
    .SetRange Range("A1:S100005")
            .
    Header xlYes
            
    .MatchCase False
            
    .Orientation xlTopToBottom
            
    .SortMethod xlPinYin
            
    .Apply
        End With
    End Sub 
    Last edited by yutoyumi; 01-25-2017 at 04:31 AM. Reason: delete

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 1
    Last Post: 08-05-2016, 04:41 AM
  2. To Sort exact and partial exact match for a single column.
    By Jagdev in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-22-2014, 05:08 AM
  3. Advanced Filtering from one sheet to another not working for exact match
    By thelisa in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-27-2013, 09:57 AM
  4. Replies: 3
    Last Post: 01-10-2012, 11:25 AM
  5. Cell Copy and Paste to another cell, opposite sign (+/-)
    By excel_man in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 10-26-2007, 09:41 AM
  6. Converting number to opposite sign (Negative to Positive)
    By tomholden in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-20-2007, 07:35 AM
  7. [SOLVED] How do I convert numbers to the opposite sign?
    By CindyatRWD in forum Excel General
    Replies: 3
    Last Post: 10-24-2005, 11:05 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1