# Compare 2 text cells and show difference in the third cell

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

-
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
@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

``````=SUBSTITUTE(B1,A1,"")