+ Reply to Thread
Results 1 to 5 of 5

Compare cell contents in different columns, then fill neighbouring cells

  1. #1
    Registered User
    Join Date
    08-10-2008
    Location
    Australia
    Posts
    5

    Compare cell contents in different columns, then fill neighbouring cells

    Hello,

    I'm sure this is an easy problem to solve - I just can't work out ANY (let alone a simple) solution.

    I have two sheets:
    - sheet 1 ('current')
    - sheet 2 ('31May')

    The data in column C is the same, although sorted differently and can't be re-sorted to be the same. Where the data in column C is the same in both sheets, I want to fill columns A and B into sheet 1. Please see the example attached (which is probably more clear than that description ).

    Any help would be greatly appreciated!!
    Attached Files Attached Files

  2. #2
    Forum Expert azumi's Avatar
    Join Date
    12-10-2012
    Location
    YK, Indonesia
    MS-Off Ver
    Excel 2019
    Posts
    2,368

    Re: Compare cell contents in different columns, then fill neighbouring cells

    Put in A2 copied down and copied cross to column B:

    =LOOKUP(2^15,SEARCH('31May'!$C$2:$C$26,$C2),'31May'!A$2:A$26)

  3. #3
    Forum Expert azumi's Avatar
    Join Date
    12-10-2012
    Location
    YK, Indonesia
    MS-Off Ver
    Excel 2019
    Posts
    2,368

    Re: Compare cell contents in different columns, then fill neighbouring cells

    Or see the file please...


    Thanks
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    08-10-2008
    Location
    Australia
    Posts
    5

    Re: Compare cell contents in different columns, then fill neighbouring cells

    Thanks Azumi - this solution appears to work only intermittently in the 'live' data. In a majority of cells, I am getting an error 'value not available'.

    Perhaps I should've added there is over 250 rows of data in the full workbooks? Does this have some impact?

    I don't understand the '2^15' at the start of the formula - can you tell me what this is for?

    I'm using Excel 2010.

  5. #5
    Forum Expert azumi's Avatar
    Join Date
    12-10-2012
    Location
    YK, Indonesia
    MS-Off Ver
    Excel 2019
    Posts
    2,368

    Re: Compare cell contents in different columns, then fill neighbouring cells

    Yes you can add rows as you like, thats non array formula, so hope it light and fast, the explnation maybe like this:

    SEARCH function searches values for C2 in ranges '31May'!$C$2:$C$26, and it will return number when found it.

    Sorry with my bad english lol

    2^15 meaning that the largest number of character that can fit in a cell is or with number is 32767, so have LOOKUP(2^15 that will find largest number than SEARCH can find it, other words you'll find the last matches that contain C2

+ 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. Fill in cells with a value based on a neighbouring column
    By ppataki in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 08-26-2014, 11:18 AM
  2. Macro to compare 2 columns cell contents and add 'Yes' flag for record
    By swarren6 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-11-2013, 03:50 PM
  3. [SOLVED] VBA Code - Compare Adjacent Cells In two columns and clear contents when a match is found
    By Langer101 in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 01-03-2013, 06:22 AM
  4. [SOLVED] Combine Cell Contents to with a [return] or [fill with spaces] between each cells contents
    By jordan2322 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-16-2012, 11:24 PM
  5. Counting cells conditional on neighbouring columns
    By BFee in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-03-2010, 02:13 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