Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

If cell A1 = abcd, cell B1 = abcdefg, then what formula to use in order to get the text difference efg?

share|improve this question
1  
Thank you for mentioning the cell references - these make answering easier and sometimes MUCH easier! – pnuts Dec 12 '12 at 10:44
    
What would you expect the answer to be if A1 = bcd and B1 = adefg ? – Lee Taylor Dec 12 '12 at 10:48
    
I expect nothing to happen (tested it of course in advance), because the string isn't present in the other string. @Lee: what would you expect? – Jacob Jan Tuinstra Dec 12 '12 at 11:04
    
@JacobJanTuinstra - I was trying to get the OP to suggest what he was trying to achieve. I don't it's completely clear what he's asking for. After all what does "text difference" mean? – Lee Taylor Dec 12 '12 at 12:26
3  
@JacobJanTuinstra Hmmm, so the text difference should be all the characters in B1 that are not in A1? So, with A1 = bcd and B1 = adefg this would be aefg? Do you not see the ambiguity? – Lee Taylor Dec 12 '12 at 13:04

By using the following formula, you can achieve just that:

=SUBSTITUTE(B1,A1,"")

Reference: SUBSTITUTE

share|improve this answer
1  
so simple... :-) nice! ...but of course not directly extensible to differences in the middle or when you don't know which cell might have the extra "different" characters - thanks for what it's worth though. – Code Jockey Feb 16 at 17:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .