Lookup range not searching for variable correctly... what am I doing wrong?

I’m at my wits end here. I am making a program that will gather some names into an excel sheet and then search a much larger excel sheet for the names. I have done this with other uipath bots and have had 0 issue with it. I can’t figure out what I am doing wrong this time, when it seems like I’m doing the exact same thing I always do.

So the section in question is this:


whenever I run the program, the output returns a null value. The names are all in column A and it should definitely find a name in the range I am searching.

I have a write line just below it that has the following: "name substring searched = "+name.Substring(0,name.length-4) and this produces the correct information every time.

if I change the lookup range to “Doe, Jo” instead of name.Substring(0,name.length-4) it will find John Doe’s name in the excel file. however even though name.Substring(0,name.length-4) is “Doe, Jo” i get a null ouput when I run the bot. what am I doing wrong? I use lookup range all the time, and I can’t figure out why its not working this time.

Any ideas would be greatly appreicated!

Hi @brian-bennett

You have to give sheet name

Kindly check name.Substring(0,name) match with sheet name

And assume that item conatins yourexcel name right?? So you have to give like path.getfilenamewithoutextension(item) it filter out the extension of your file example (before filter input.xlsx after filter input)


this is nested in a for loop which cycles through an array of sheet names. that is why item.substring is in the sheet section of the lookuprange. that works perfectly when i have the name in quotes as the searchable name. I don’t think that would be the issue just because I change the name “Doe, John” to name.substring(0,name.length-4)

Can you share your overall file with dummy data

oh my god!!! so i pull the names from this old dos based computer system that we use at work and its a giant pain in the butt… I just switched it to name as you suggested and it worked for the first one I typed in as John Doe, and stopped working for the other ones. Why did it stop you ask?

Because all of the names that are pulled from the dos system have a damn space in front of them!!! name.substring(1,name.length-4) to the rescue!! sorry for the dumb question, but I thank you for responding and helping me figure it out!!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.