Possible to count the number of '+' appearing in an excel column?

I would like to improve my process to accommodate for changes in the future and would like to change the bot from finding “LP” keywords to the number of times ‘+’ plus signs appear within a row is that possible?
image

I get this error when replacing “LP” with “+” using the code shown above
image

hi @lmoham

can u show thw excel column please?


Heres the column for it, I would like to get the same results but finding ‘+’ plus signs instead of ‘LP’.

1 Like

(From row in outData.AsEnumerable() Where row.item(0).ToString.Contains(“+”) Select row.Item(0)).ToList()

you can use For each to print them and just do this to check Item.Count

Try this and let me know.

1 Like

Hi @lmoham

Please use the below method.

System.Text.RegularExpressions.Regex.Matches(yourVariable,“[+]”).count

Feel free to reach us at any time if you have doubts. Thanks.

Happy Automation

1 Like

@lmoham

Check as below

System.Text.RegularExpressions.Regex.Match(sampleString,"LP").Value.ToArray().Count()

Mark as solution if this helps you

Thanks

1 Like

Thanks again and yes your code worked the way I desired!

Thanks to everyone chipping in too ^^

1 Like

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