# Compare text in a cell with the text in the previous cell and return a value

1. ## Compare text in a cell with the text in the previous cell and return a value

Hi
I am looking for macro code or excel function to compare text in a cell (A2) with the text in the previous cell (A1) and return a percentage of differences in B2, and a value of text in C2
Eg.
A1: Atlantic Ocean B1: 100% C1: New
A2: Ocean B2: -46.67% C2: Deletion
A3: Atlantic Ocean B3: +46.67% C3: Addition
A4: Pacific Ocean B4: -46.67% C4: Modification

2. ## Re: Compare text in a cell with the text in the previous cell and return a value

Hi

How was that percentage calculated?

rylo

3. ## Re: Compare text in a cell with the text in the previous cell and return a value

The percentage is just an example. The formula I am seeking should be able to calculate it.

4. ## Re: Compare text in a cell with the text in the previous cell and return a value

I think the question was more: why 46.67% ?

You really need to outline the rules governing comparison:

- are you interested in words only ?

- are there rules regards repetition ? (New York and New York New York - same or different ?)

- are the positions of the words relevant ? (Car Park and Park Car - same or different ?)

- is case significant ?
Provide a multitude of examples... there are plenty of UDFs out there that do this type of thing but they will vary slightly given the above requirements.

There are currently 1 users browsing this thread. (0 members and 1 guests)

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