+ Reply to Thread
Results 1 to 9 of 9

multiple values in an array

  1. #1
    Registered User
    Join Date
    02-24-2014
    Location
    Bishops Stortford, England
    MS-Off Ver
    Excel 2007
    Posts
    10

    multiple values in an array

    I'm having a thick moment!!
    Basically, i have two columns of numbers. Column a is unique and column J has multiples of column a (though not all column a values match). I need to match and colour each corresponding value. The attached spreadsheet and macro works but i'm not sure how to increase the array so it looks for each value. Some of the spreadsheets i have to check are in excess of 100K rows. Ouch!
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: multiple values in an array

    This will search in column A

    Please Login or Register  to view this content.

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Last edited by AB33; 06-27-2014 at 09:45 AM.

  3. #3
    Forum Expert Vikas_Gautam's Avatar
    Join Date
    06-04-2013
    Location
    Ludhiana,Punjab, India
    MS-Off Ver
    Excel 2013
    Posts
    1,850

    Re: multiple values in an array

    hi,

    I have solved your problem with a different code..
    a subroutine named test()

    before running the code, just Uncolor All the cells...
    just run the code a enjoy the magic...

    Vikas Gautam

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by Vikas_Gautam; 06-27-2014 at 10:08 AM.

  4. #4
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: multiple values in an array

    A simple countif() with Conditional Formatting (CF) method will do that

    =COUNTIF($A$2:$A$113,B2)

    B2 Should be the active cell while applying the CF


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  5. #5
    Forum Expert Vikas_Gautam's Avatar
    Join Date
    06-04-2013
    Location
    Ludhiana,Punjab, India
    MS-Off Ver
    Excel 2013
    Posts
    1,850

    Re: multiple values in an array

    Does it help.... Peterjohns..

    Just let me.. know...

    Vikas gautam

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    02-24-2014
    Location
    Bishops Stortford, England
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: multiple values in an array

    Vikas,
    yes it does work. many thanks.

    however, in Col D this is a hierarchal value, can be 10, 20, 30, 40, 50 or 100.
    Would it be easy to modify your solution so that it only works on those with a value of a 100?

    My fault I forgot that rather relevant point.

  7. #7
    Registered User
    Join Date
    02-24-2014
    Location
    Bishops Stortford, England
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: multiple values in an array

    AB33,
    I have 2 problems with this. For some reason the 'Rng.Interior.ColorIndex = myColor(I)' throws up an error of 'Runtime 9 'out of range'
    the second part is my own fault. Can it be modified so that that only values of 100 in Col D are coloured, i had forgotten about that when I send in the post.

    many thanks in anticipation.

    PeterJ

  8. #8
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: multiple values in an array

    Okay! I can correct that error. As it is now, your code colours columns A and J.
    "Can it be modified so that that only values of 100 in Col D are coloured?"
    Do you mean if the rows in column J and A match and if the value if column D is 100, colour that cell?
    There is no row where the match is found and column D value is 100. Or am I missing something?

  9. #9
    Valued Forum Contributor
    Join Date
    03-21-2013
    Location
    cyberia
    MS-Off Ver
    Excel 2007
    Posts
    457

    Re: multiple values in an array

    Quote Originally Posted by PeterJohns View Post
    Column a is unique and column J has multiples of column a (though not all column a values match). I need to match and colour each corresponding value.
    ...
    Some of the spreadsheets i have to check are in excess of 100K rows. Ouch
    Peter,

    If this quote does indeed accurately describe your dataset, and you do have 100K+ rows, and want to bypass rows with 100 in col D, then you may like to try the following
    Please Login or Register  to view this content.

+ 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. Is there a shorter way to use an array to look up multiple values?
    By sbrnard in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 05-06-2014, 04:14 PM
  2. [SOLVED] Return multiple values from an array
    By tig1142 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 12-27-2013, 08:31 PM
  3. macro to get an array of values from multiple sheets
    By tmiller1 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-12-2013, 12:30 PM
  4. Find a value in an array and return multiple values in an adjacent array
    By tonbra in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-02-2012, 08:35 PM
  5. Array Lookup, Return/Sum Multiple Values
    By mre2000 in forum Excel General
    Replies: 3
    Last Post: 01-18-2010, 10:45 PM

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