+ Reply to Thread
Results 1 to 6 of 6

Compare a cell value to a range of values, copy offset cell

  1. #1
    Registered User
    Join Date
    03-08-2012
    Location
    Notts
    MS-Off Ver
    Excel 2010
    Posts
    71

    Compare a cell value to a range of values, copy offset cell

    Morning,

    I have a range of values within ("B6:B57") (lets call it B_range) and another range of values within ("E6:E57") (lets call it E_range).
    B_range can change and it is data that is pasted in earlier before the macro is run (they are varying week numbers mixed up).
    E_range remains constant, (they are week numbers in order from W01 to W52).

    If a Value in E_range, lets say "W06", matches a value in B_range, (another "W06"), then the value offset by (0, 1) to B_range needs to be copied to the empty cell offset (0, 1) to corresponding the E_range value.


    The only thing I can think of is very long winded, Im sure theres a much easier and faster way:

    Please Login or Register  to view this content.
    And then this code would just be repeated another 51 times... VERY LONG!


    Any help greatly appreciated!

  2. #2
    Forum Expert Jakobshavn's Avatar
    Join Date
    08-17-2012
    Location
    Lakehurst, NJ, USA
    MS-Off Ver
    Excel 2007
    Posts
    1,970

    Re: Compare a cell value to a range of values, copy offset cell

    Is this close to what you need:

    Please Login or Register  to view this content.
    Gary's Student

  3. #3
    Registered User
    Join Date
    03-08-2012
    Location
    Notts
    MS-Off Ver
    Excel 2010
    Posts
    71

    Re: Compare a cell value to a range of values, copy offset cell

    Just reading through the code, that seems very close to what I need...

    The only problem is that the range in B column will be mixed, so it will not always match the week numbers directly offset by (0, 3).

    eg. W01 in B_range may not be opposite W01 in F_range. It may be further down the list.

  4. #4
    Forum Expert Jakobshavn's Avatar
    Join Date
    08-17-2012
    Location
    Lakehurst, NJ, USA
    MS-Off Ver
    Excel 2007
    Posts
    1,970

    Re: Compare a cell value to a range of values, copy offset cell

    Try tthis instead:

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    03-08-2012
    Location
    Notts
    MS-Off Ver
    Excel 2010
    Posts
    71

    Re: Compare a cell value to a range of values, copy offset cell

    You are a God.

    Thank you very much!
    Case Solved.

  6. #6
    Forum Expert Jakobshavn's Avatar
    Join Date
    08-17-2012
    Location
    Lakehurst, NJ, USA
    MS-Off Ver
    Excel 2007
    Posts
    1,970

    Re: Compare a cell value to a range of values, copy offset cell

    not even a cherub

+ 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