+ Reply to Thread
Results 1 to 3 of 3

Macro to Loop through range, change values

  1. #1
    Registered User
    Join Date
    07-25-2013
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    88

    Macro to Loop through range, change values

    Hi all,

    I have a problem that's been confusing me. I have a few hundred columns that all contain numerical data in rows 2 - 41. What I want to do is convert my data into a nominal scale, replacing the numbers with either a 1, 2, 3, 4. The 1, 2, 3, or 4 designates the data that was contained in that cell as either in the first quartile, second, third, or fourth.

    In the attached sheet, you can see that I have the quartiles broken out for each range. So, for example, in column B, all values from the minimum of 1.7 to the first quartile of 322.8 would be replaced with a 1. Everything from the first quartile 322.8 to the second quartile/median of 869.2 would be replaced with a 2, and so on until everything in that column is either a 1, 2, 3, or 4.

    My data is always in row 2 through 41 (always 40 items). The only changes are that the different columns will have different numbers and therefore different quartile parameters. I'd like something that would say, "If cell value is between the min and first quartile, then "1", etc."

    Can someone point me in the right direction? I'm trying to come up with something myself but I can't solve how to express this. Thanks for reading.

    -Student1990


    Ranking.xlsx

  2. #2
    Registered User
    Join Date
    10-30-2012
    Location
    Modlin , Poland
    MS-Off Ver
    Excel 2003, Excel 2007
    Posts
    42

    Re: Macro to Loop through range, change values

    hi, try this:

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    07-25-2013
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    88

    Re: Macro to Loop through range, change values

    Thank you! That helped me see how to set this type of thing up.

+ 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. Should I loop this code or can I change range?
    By cmcmullen42 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-24-2014, 12:08 PM
  2. Can you change the order/pattern that vba uses to loop through a range?
    By Leon V (AW) in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 06-14-2013, 04:40 AM
  3. Copy cell values until change of value with loop
    By sdadswell in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-04-2011, 08:40 PM
  4. Macro Loop to Extract Specific Values and Min/Max Values From Column/Rows Range
    By ExcelQuestFL in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 12-19-2010, 09:19 AM
  5. How to change values of userdefined cell names in a loop?
    By 77anders in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-05-2009, 10:21 AM

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