+ Reply to Thread
Results 1 to 9 of 9

Excel cell comparision

  1. #1
    Registered User
    Join Date
    05-17-2013
    Location
    nashville, usa
    MS-Off Ver
    Excel 2003
    Posts
    6

    Excel cell comparision

    ExcelComparision.xlsx
    Hello,

    I have two columns as below..
    PHP Code: 
    ColumnA                                                                ColumnB
    apple                                                                     apple
    banana                                                                   apple
    orange banana apple                                                 apple   banana orange
    apple banana                                                           banana    apple  orange 
    now I want to compare these two cells. The problem here is eventhough vaules are same in both cells, as they are in different order, when i compare it, it says false. I'm using simple command "trim(A2)=trim(b2)". Also there could be extra spaces and special characters in any of those cells. I have attached the workbook with sample data.

    I should see following result...

    PHP Code: 
    ColumnA                                   ColumnB                           ColumnC
    apple                                       apple                                TRUE
    banana                                    apple                                 FALSE
    orange banana apple                  apple   banana orange          TRUE
    apple banana                            banana    apple  orange        FALSE 
    Is there any command I can use to accomplish this? Please advise. Thanks.

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,052

    Re: Excel cell comparision

    What does your actual data look like, how close is it to your sample?
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Registered User
    Join Date
    05-17-2013
    Location
    nashville, usa
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Excel cell comparision

    It is pretty close to my actual data except that cells may have extra values, may have extra spaces in any or both cells and may have special charter (*Apple *Orange). Thanks.

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,052

    Re: Excel cell comparision

    by "extra values", do you mean like aaa bbb ccc ddd eee ? (more than the 3 words in your samples?

  5. #5
    Registered User
    Join Date
    05-17-2013
    Location
    nashville, usa
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Excel cell comparision

    That is correct.

  6. #6
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,052

    Re: Excel cell comparision

    If it was restricted to just 3 words, I could probably put a formula together for you to to this. It could still be done for more than 3, but it will become complex and too involved. I think you will need VBA for this, so I will move it to that forum for you

  7. #7
    Registered User
    Join Date
    05-17-2013
    Location
    nashville, usa
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Excel cell comparision

    Thanks. It may have upto 15 values.

  8. #8
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,052

    Re: Excel cell comparision

    My thoughts were to break down (within 1 formula) each word from the 1st column and then compare that to the 2nd column, but 15 "break-outs" will become unmanageable

  9. #9
    Registered User
    Join Date
    05-17-2013
    Location
    nashville, usa
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Excel cell comparision

    if this can simplify the logic, this will work for me. If column1 values exists in column2, set to "true" else set to "false" in column 3.
    for example result should be as below

    column1 column2 column3
    apple, orange apple, orange, banana True
    apple apple True
    apple, orange banana grape False
    banana grape banana grape apple, orange True

    Please advise. Thanks
    Last edited by srive99; 01-02-2014 at 12:51 PM.

+ 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] Column Comparision-Progressive scan and format cell
    By analystbank in forum Excel Programming / VBA / Macros
    Replies: 23
    Last Post: 10-08-2013, 02:30 AM
  2. Inserting/Displaying Arrow (Up or Down) in a cell on Comparision
    By dvrajaneesh in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-17-2013, 04:34 AM
  3. Excel - Date comparision in VBA
    By Silencer116 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-24-2006, 06:15 AM
  4. Replies: 1
    Last Post: 09-13-2005, 07:05 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