Disjointed search replace

This is another Excel question.

We’ll say I have 2 columns A & B. I would like to perform a search for a word in B and if it exists, I would like a corresponding number to go into that same row, but in column A. So my example is:

A B
___ bing
___ bang
___ boom

My script would do a search for bing in column B and put the number 2 in column A so it would like:

A B
2 bing
3 bang
1 boom

Thanks again,

Kim

Jacques, thank you so much for this and my other question regarding the error in my repeat. Being fairly new to AppleScript, I’m not familiar with the try/end try command, so it didn’t occur to me to try it.

What’s happening now is that it will do the first one, and seemingly hang as if it’s in a loop. How do I get out of this loop? It now looks like:

try
	repeat
		tell (find range "B:B" what "bing") to set value of (get offset column offset -1) to 2
	end repeat
end try

.Applying the example I read in my other post.

Actually, I did a workaround by copying the column to the first column position and running the script there without the offset, but I really would like to know how to make it work.