I need to apply logic in excel

  1. I have 9 digits in A column till 5 rows
  2. I have 10 digits in A column from 6 Row till 10 rows
  3. Now I need to apply two different formulas in same A Column
  4. The same thing need to apply in UiPath but bot doesn’t know in which row onwards 10digits starts

Could any one help me with steps if possible
Thanks a lot in Advance

can use the length method if less then 9 apply formula 1 or apply formula 2

Yeah but in Uipath in If condition how can we apply for within single column

Hi @itsmegovardhan

What formula you need to apply if you are bit more specific it would be helpful…


  1. I have 9 digits account number in A column
  2. I have few rows with 10 digits in same A column
  3. Now i need to apply Formula1(=Mid(A1,3,10)) and Formula2 (=Mid(A6,6,9))
  4. For 10 digits account number 0 or any one digit has added so to avoid that i need to pull only 9 digits


Hi @itsmegovardhan

Please try these steps,

Use Read range and store the excel values in a data table (i have used build data table for testing)


Use Invoke code activity and write this code,

dt.AsEnumerable.Where(Function(row) row(0).ToString.Length = 9).AsEnumerable.ToList.ForEach(Sub(row) row(0) = row(0).tostring.substring(5,4))
dt.AsEnumerable.Where(Function(row) row(0).ToString.Length = 10).AsEnumerable.ToList.ForEach(Sub(row) row(0) = row(0).tostring.substring(2,8))

pass the data table as using edit arguments in invoke code activity,

Please check if the output is matched with you requirement, first one is for 9 digits and 2nd one is for 10 digits,

use Write range and write the data table into the excel sheet.



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