+ Reply to Thread
Results 1 to 3 of 3

Filtering certain criteria

Hybrid View

  1. #1
    Registered User
    Join Date
    05-18-2012
    Location
    Norwalk, CT
    MS-Off Ver
    Excel 2010
    Posts
    80

    Filtering certain criteria

    Hi, I'm posting some data downloaded from google finance.

    Column A contains prices
    Column B contains the frequency of Column A in the data set (i.e. B1 contains the number of occurrences of A1). So 9 appears 4 times.
    Column C is simply numbered
    ====================
    Column A goes stale at $6 from (A248:A500).

    I want to locate this stale period and change all values to 100 and color them pink. The problem is, if the price was 6 outside this stale range, I do not want it changed.

    i.e. I do not want A177 changed. I do not want anything except A248:A500 changed for that matter.

    Thanks,
    nick



    Here is what I have so far:

    1) I filter A for my own sanity
    2) I filter B in descending order to bring the most frequent price to the top
    3) I simply change all the 6's to 100 and color them pink
    4) Finally, I filter back to the original order.

    Sub aa()
    Dim x As Double
    Range("A1").CurrentRegion.Sort Key1:=Range("A1"), Order1:=xlAscending
    Range("A1").CurrentRegion.Sort Key1:=Range("B1"), Order1:=xlDescending
        With Range("A1:A" & Cells(1, 2))
            .Value = 100
            .Interior.ColorIndex = 40
        End With
    Range("a1").CurrentRegion.Sort Key1:=Range("C1"), Order1:=xlAscending
    End Sub
    Test2.xlsm

  2. #2
    Forum Expert JapanDave's Avatar
    Join Date
    06-10-2008
    Location
    The grid, I got in!
    MS-Off Ver
    Excel 2010/13
    Posts
    1,696

    Re: Filtering certain criteria

    Is row 523 to 525 a stale period? What is the rule for a stale period?
    Be fore warned, I regularly post drunk. So don't take offence (too much) to what I say.
    I am the real 'Napster'
    The Grid. A digital frontier. I tried to picture clusters of information as they moved through the computer. What did they look like? Ships? motorcycles? Were the circuits like freeways? I kept dreaming of a world I thought I'd never see. And then, one day...

    If you receive help please give thanks. Click the * in the bottom left hand corner.

    snb's VBA Help Files

  3. #3
    Registered User
    Join Date
    05-18-2012
    Location
    Norwalk, CT
    MS-Off Ver
    Excel 2010
    Posts
    80

    Re: Filtering certain criteria

    Oops my bad,

    The rule is edit the largest stale period.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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