+ Reply to Thread
Results 1 to 7 of 7

I need help highlighting cells using a Text Similarity Calculation Formula

  1. #1
    Registered User
    Join Date
    12-24-2015
    Location
    Europe
    MS-Off Ver
    2010
    Posts
    4

    I need help highlighting cells using a Text Similarity Calculation Formula

    Hello there. I need help with excel. To say it short (I'm also uploading photos), I have 3 columns of synonymous phrases, side by side, looking like this:

    Column A Column B Column C

    in America in the us in the usa
    make sure you be sure you ensure you
    odds are it’s likely that it’s likely
    So how Just how So just how
    this means that which means that which means
    that you like that you want you want
    to have a to truly have a to really have a
    will be the would be the could be the
    You're not You are not You aren't

    Example1.png

    My task is to calculate the two highest similar phrases between the phrases in columns A,B and C, comparing A with B, A with C and B with C. In fact, I already have done the comparison and its calculations, as shown on the photo, using Excel Powerup tools and the following formulas:

    =pwrSIMILARITY(B:B,C:C,FALSE)
    =pwrSIMILARITY(A:A,B:B,FALSE)
    =pwrSIMILARITY(A:A,C:C,FALSE)

    What I need however is, based on the result, the highest value, most similar two phrases, be it in Column A and B, A and C, or B and C, to be highlighted, and the one which is the least similar cell containing the third phrase - removed or just left non-highlighted.

    Maybe it sounds a bit complicated at first read, but I think a picture's worth a thousand words and if you have questions, you may ask me, I will clarify it for you.

    Example2.png

    Most of the phrases inside it, whether on position (cell) 1, 2 or 3 (cells A,B,C), are highly similar, but often a phrase, which is not identical stays between these 2 similar phrases, sometimes in Cell A, sometimes in Cell B and sometimes in Cell C. Ascending and Descending order for arrangement does not work in here, I have already tried it. I need similarity calculation, which I have luckily already accomplished!

    I need a formula, a method, a tool(s). Something, anything, which based on the highest similarity score, highlights the two most similar Cells in a row, be it A and B, A and C, or B and C.

    Example3.png
    Example4.png

    Thank You Very Much. Looking forward to your replies.
    Anything unclear? Ask me and I will reply immediately!

  2. #2
    Valued Forum Contributor
    Join Date
    12-28-2014
    Location
    NSW, Australia
    MS-Off Ver
    MS365
    Posts
    604

    Re: I need help highlighting cells using a Text Similarity Calculation Formula

    Pictures don't help a lot, having a sample sheet to play with makes a huge difference.
    I assume the three columns (F,I,L) calculate the similarity between A-B, A-C, B-C (probably not in that order).

    Can you insert 3 helper columns (say X,Y,Z) beside each other (representing whether A B or C should be highlighted).
    Then in each helper make an IF statement place a 1 in the cell if it is not MIN out of the 3 calculation columns.
    e.g. If columns A-B and A-C were matched by F and I, then if L was the MIN out of the three place a 1 in X and Y.
    That way if A & B were the closest matches then C would be the MIN of the results and would NOT have a 1 in the cell.
    Now you can use conditional formatting to highlight A, B, or C according to whether there is a "1" in XYZ (or where ever).

    I know nothing about the formula you're using so I apologise it this won't work at all It's just an idea I'm throwing out there.


    Edit: Hmmm... if that does work, then maybe you don't need the helpers.
    Maybe condition formatitng for A could be something like IF F is NOT the MIN of F,I,L then highlight.


    Edit 2: Actually, without data to play with, I now think you might need to use MAX and check both columns that A is calculate in.

    Sorry....rambling.....too much xmas cheer
    Last edited by Beamernsw; 12-25-2015 at 12:54 AM.

  3. #3
    Registered User
    Join Date
    12-24-2015
    Location
    Europe
    MS-Off Ver
    2010
    Posts
    4

    Re: I need help highlighting cells using a Text Similarity Calculation Formula

    I think you are absolutely right I should attach the sheet with the data itself, so here you go ...

    And thank you very much for you quick response! I really appreciate that!

    Maybe this formula (=pwrSIMILARITY, etc) will work only, if you have Powerups installed ... However, in this case I'm looking for something which highlights the cells, based on the value, so this should not be a concern ...

    But I pretty much think it's an alternative of =COMPARESTRING(B1,A1,FALSE) which should work without Powerups installed (I assume as a probability).

    Good mood is always A Factor, in all aspects, especially today! Cheers!
    Attached Files Attached Files
    Last edited by profiwriteraz; 12-25-2015 at 01:50 AM.

  4. #4
    Valued Forum Contributor
    Join Date
    12-28-2014
    Location
    NSW, Australia
    MS-Off Ver
    MS365
    Posts
    604

    Re: I need help highlighting cells using a Text Similarity Calculation Formula

    Try this out.
    Columns O,P,Q place a 1 in the column to represent whether A,B,C are in the top 2 choices.

    You could most likely put those formulas into the conditional formatting for each column instead.
    I didn't try because this way you can tweak the formulas easier if necessary.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    12-24-2015
    Location
    Europe
    MS-Off Ver
    2010
    Posts
    4

    Re: I need help highlighting cells using a Text Similarity Calculation Formula

    Thanks, it seems to be working, however I think I should find a better alternative method of the PowerUps calculators in F, I and L ... Your formula surely works though. I should only mention that it didn't highlight the cells in a detectable manner, so I edited the rules, e.g. Home Tab>Conditional Formatting>Manage Rules ..., where I made it BOLD them in the Conditional Format Rules Manager, so that they are automatically detectable, if not in Excel, in Word.

    I hope this thread will help somebody else in my situation!

    Thank for Your Timely Assistance! I highly appreciate that!
    Last edited by profiwriteraz; 12-25-2015 at 11:39 PM.

  6. #6
    Valued Forum Contributor
    Join Date
    12-28-2014
    Location
    NSW, Australia
    MS-Off Ver
    MS365
    Posts
    604

    Re: I need help highlighting cells using a Text Similarity Calculation Formula

    OK, I can't help you with the statistics, but I can tell you what my formula does.
    And I can't check any other rows than are what are shown in the file because the cells all turn to errors if I try to unhide them.
    Also the COMPARESTRING function doesn't exist in Excel 2010 either.
    As for my formula, it's quite simple really and the "1" means nothing, it's just a marker.

    Looking at the formula in Cell O1:- IF(OR(I1=MAX($F1,$I1,$L1),L1=MAX($F1,$I1,$L1)),1,"")

    The parts outside the MAX bits - IF(OR(…….),1,"") - say that IF either of the 2 MAX statements are true then place a 1 in cell O1 or leave it blank (instead of 1 it could say "MAX" or "Highest Result" for instance.
    The 1st MAX statement looks to see if I1=MAX(F1,I1,L1) and the 2nd looks to see if L1=MAX(F1,I1,L1)
    So if either column I or column L are the MAX of the three then it will place a 1 in cell O1

    Cell P1 does the same except it checks to see whether Column F or I have the MAX result
    Cell Q1 does the same except it checks to see whether Column F or L have the MAX result

    Then the conditional formatting simply colours columns A,B,C if columns O,P,Q have a 1 in their cells.
    e.g. Since O34 and P34 have a 1 in them, A34 and B34 get coloured.

    I'm not certain this was the best way to do it, but this at least explains what my formula is looking for and what it does.

    I hope it helps you.

  7. #7
    Registered User
    Join Date
    12-24-2015
    Location
    Europe
    MS-Off Ver
    2010
    Posts
    4

    Re: I need help highlighting cells using a Text Similarity Calculation Formula

    Thank You Very Much! Your formula works and I believe I understood what it does, at least partially. As for the statistics, I use parts of speech for extra orientation, but still it's not perfect, although better. I would really appreciate if I can somehow get better statistics, based on semantic similarity from someone ... Your formula works! It does!

    Thank You

+ 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. % similarity between 2 cells of text
    By guerillaexcel in forum Excel General
    Replies: 11
    Last Post: 03-12-2015, 06:58 PM
  2. Replies: 1
    Last Post: 11-12-2014, 10:57 AM
  3. [SOLVED] Comparing Similarity in Text Values VBA
    By MikeRoot in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-31-2014, 11:10 AM
  4. [SOLVED] How to compare the similarity of 2 cells?
    By glux in forum Excel General
    Replies: 4
    Last Post: 07-29-2012, 03:42 AM
  5. How to find similarity of cells?
    By zhshqzyc in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-04-2011, 07:45 PM
  6. Similarity of Two Text Strings
    By longfisher in forum Excel General
    Replies: 1
    Last Post: 05-03-2008, 12:47 PM
  7. [SOLVED] Evaluating similarity of text strings
    By Alan in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 03-29-2005, 09:06 PM

Tags for this Thread

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