Find string and if correct write number to cell

I have a problem where I would like to read a Data table containing different fruits for example, and then see if a cell in an already created excel sheet contains that fruits word. For example, if A1 has the word “Apple” in it, I want to send a 1 to cell A3 and 2 to B3. Then right after that if there is any fruits in the cell D1 then write the number 2 to D3. If not, loop through automation again with another opened excel file and sheet.
If there is any way to check if a cell contains a specific word and if it does change the outcome depending on what it is it would be really helpful if someone could help me!
Thank you

Maybe you upload your example and also the Excel file?


Thank you for the quick reply!
For now, the only thing I have to provide is a template of what needs to be done. Using the same example as mentioned above it might be a bit easier to understand what I am trying to accomplish.


In the picture above, in the cell L2 and L3 there are positions written. Depending on what position is written (in this case “Centre-Back”) in main position, I want to send the number 1 to the column J and K with the row representing the position (in this case “CB”).
Same thing applies for the L3 cell except that it will be a number 2 and only in the K column.

Hopefully this clear things up and I am sorry I can not provide with more material for now. I should have more of it done by tomorrow to share!


I will send you a zip containing the excel files required and my automation idea so far!
Obviously nothing is really working but looking at the automation will give a clear idea of what is going on and my thought process.
Appreciate all the help! (20.7 KB)

Managed to solve one of my problems with using a variable in the range box.
Previous: “J” + row(2).ToString : “K” + row(2).ToString
Solution: “J” + row(2).ToString + “:” + “K” + row(2).ToString

Figured I would write it in case anyone had a similar issue!