+ Reply to Thread
Results 1 to 7 of 7

Need to compare 3 cells and replace 1

  1. #1
    Registered User
    Join Date
    10-01-2014
    Location
    NC
    MS-Off Ver
    Pro Plus 2013
    Posts
    34

    Need to compare 3 cells and replace 1

    Hello, I need to compare the value in 3 cells and if they match replace one of the cells value. For example, compare A2 and C2. If they match replace A2 with D2 value. Column A is going to have allot more values then Column C and D if that matters. See attached sheet for example.
    Thank You!

    Compare.xlsx

  2. #2
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Need to compare 3 cells and replace 1

    Okay, you say compare 3 cells, so does that mean A2 is compared to B2 and C2 and if it matches either, then replace A2 with D2?

    Secondly, you say there are more values in A than in C and D. So if, let's say A25 matches B25, what would you replace it with? Or are we not just looking at one row at a time?

    Lastly, FYI, this will require a macro to do once we figure out exactly what you want to do.
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Registered User
    Join Date
    10-01-2014
    Location
    NC
    MS-Off Ver
    Pro Plus 2013
    Posts
    34

    Re: Need to compare 3 cells and replace 1

    Quote Originally Posted by ChemistB View Post
    Okay, you say compare 3 cells, so does that mean A2 is compared to B2 and C2 and if it matches either, then replace A2 with D2?

    Secondly, you say there are more values in A than in C and D. So if, let's say A25 matches B25, what would you replace it with? Or are we not just looking at one row at a time?

    Lastly, FYI, this will require a macro to do once we figure out exactly what you want to do.
    No you can ignore column B because that is going to be identical to C. I need to compare Column A and column C. If any cells value match then replace the cell in column A with the cell of column D making sure to keep the same posistion of the cell in column A.

    Since there are more values in column A then in column C, if C40 matches A150 then D40 will replace A150. Make sense?

    OK, i think that may explain it better.
    Last edited by jewelr; 10-03-2014 at 05:54 PM.

  4. #4
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Need to compare 3 cells and replace 1

    Hi,

    Without a macro you could use a helper column to establish what column A should be and then copy the helper column and paste it as values back to column A

    So for instance in E2 copied down

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  5. #5
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 V 2504
    Posts
    13,745

    Re: Need to compare 3 cells and replace 1

    Quote Originally Posted by jewelr View Post
    No you can ignore column B because that is going to be identical to C. I need to compare Column A and column C. If any cells value match then replace the cell in column A with the cell of column D making sure to keep the same posistion of the cell in column A.

    Since there are more values in column A then in column C, if C40 matches A150 then D40 will replace A150. Make sense?

    OK, i think that may explain it better.
    Drawing from the uploaded workbook:

    To clarify further, if it is the other way around....C150 matches A40.....then D150 replaces A40?

    In addition there is a triplication of an item with-in A; C has the same duplicated with-in C. Which do you want to replace in A and where do you want it put?
    Last edited by FlameRetired; 10-03-2014 at 10:42 PM.

  6. #6
    Registered User
    Join Date
    10-01-2014
    Location
    NC
    MS-Off Ver
    Pro Plus 2013
    Posts
    34

    Re: Need to compare 3 cells and replace 1

    Quote Originally Posted by Richard Buttrey View Post
    Hi,

    Without a macro you could use a helper column to establish what column A should be and then copy the helper column and paste it as values back to column A

    So for instance in E2 copied down

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Thank You Richard Buttrey! That worked perfectly.

  7. #7
    Registered User
    Join Date
    10-01-2014
    Location
    NC
    MS-Off Ver
    Pro Plus 2013
    Posts
    34

    Re: Need to compare 3 cells and replace 1

    Quote Originally Posted by FlameRetired View Post
    To clarify further, if it is the other way around....C150 matches A40 then D150 replaces A40?
    It was just the one way around. Thanks for chiming in FlameRetired! This is an awesome source for excel help .

+ 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. [SOLVED] Compare and Replace
    By maddog9486 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 01-14-2014, 05:48 PM
  2. Compare and replace with corresponding
    By Hellkeeper in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 12-03-2012, 01:25 PM
  3. Compare and replace
    By lavofra in forum Excel General
    Replies: 9
    Last Post: 03-06-2012, 06:33 AM
  4. Compare and replace
    By dimitriz in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-27-2009, 07:43 AM
  5. Q: compare and replace in a workbook
    By Arnfinn Hakkebo in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-13-2005, 08:06 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