How to check if a cell contains keywords?

Hi there,

I am trying out below:

if (remarks = “Special Container Handling detected”)
then {copy into excel}
else {do nothing}

however, for the remarks column, i have multiple various forms as below:

  1. Shipment/Conn pending vetting/confirmation
    Special Container Handling detected
    VGM Pending Confirmation detected

  2. Special Container Handling detected

  3. Special Container Handling detected
    VGM Pending Confirmation detected

  4. so on and so forth . . .

I want to extract all remarks that contains the text “Special Container Handling detected”
i.e. as long as the cell contains the text, i want to copy it to another sheet.

how do i go about doing it?

Thanks!

hope my inputs are useful

Hi rkelchuri,

Apologies, but i am relatively new to VBA.
Seems like the post is for excel macros?
is there a way i can do it within uiPath instead of writing macros and executing them in excel?

Thanks!

Yes it is possible by using UiPath. again you will adopt VB scripting to validate the string values for special characters on the cell value.

let’s consider same example what you explained.
if (remarks = “Special Container Handling detected”)
then {copy into excel}
else {do nothing}

remarks is a string which is going to read cell value and store in it.
TestPos = InStr(4, SearchString, SearchChar, CompareMethod.Text)
This TestPos will return true or false binary values 0 or 1.

Hope my inputs are useful

You can try this simple condition instead -

if (remarks.Contains("Special Container Handling detected”))
then {copy into excel}
else {do nothing}

For more details Contains please refer -String.Contains Method (System) | Microsoft Learn

Regards,
Amrita

1 Like