# If a word in a range then check the left word of this word

##### New Member
Hi, I would like to use Macro to check a word whether it is in a range, if it is in a range, then to check the left word of this word.
For example:

The range in Excel is:
 Name Age Ingrid 30 Peter 20 Hans 18 Jan 35

<tbody>
</tbody>

The texts in my MS Word are :
45 Jan, 30 Ingrid 18 Hans and 30 Peter.
How can I use Macro in Word to Check the range in Excel whether the age is correct or not?

In this example the age of Jan and Peter are not right. Because Jan is 35 and Peter is 20.

Thanks
Frank

### Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"

#### FDibbins

##### Well-known Member
Is this an Excel or a Word question? (you posted in excel)

##### New Member
Yes, the range is in Excel. But the texts are in Word.

#### jimrward

##### Well-known Member
How many names are in your lookup list with the correct data currently in your excel range

##### New Member
I am not sure now. suppose 500.

##### New Member
My logica is;

1. First it will check the words in MS word (a loop), if a word is in the list of Excel (mabye via Array), it will find the left word of it and it will use VLookup to see whether the left word is the same as in Excel.
2. If it is not the same it will pop up a message to let the user to replace it or not.

#### jimrward

##### Well-known Member
500 unique names and ages ?? Or is this the number of names in your word document, what happens when you have two peters with different ages in your excel list

##### New Member
Yes. The names in the Excel are unique.

Replies
3
Views
555
Replies
7
Views
1K
Replies
2
Views
407
Replies
5
Views
187
Replies
4
Views
2K

1,195,936
Messages
6,012,393
Members
441,695
Latest member
MickRobertson

### We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.

### Which adblocker are you using?

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

### Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

### Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back