How to write two formulas in one column based on digits

  1. after i apply formula1(=mid(C1,3,10)) i have 9 digits and 12 digits account numbers in H column
  2. now i need to apply formula2(=mid(C1,6,9)) for those account numbers are 12 digits in same H columnimage
  3. so finally i need to get 9 digits account number

Note: i am extracting number from C column

please help me in this

Regards
Govardhan

@itsmegovardhan

You can use For Each Rows activity and Inside that you can place an IF condition
Into that you can write as Row(“Columnname”).Tostring.Length = 9

Then place your formula for 9 digits else place your condition for 12 digits

Hope this may help you

Thanks

i tried if condition even though bot is executing only else part that mean which ever formula we kept in else part executing this is input given
image
this is the formula given


but bot is executing only else part
this is final output
image

Formula1(=mid(C2,3,10))
Formula2(=mid(C2,6,9))

I guess the problem is that you evaluate the condition based on particular row but write the formula to range
image

Cheers

“H2:H”+(Data.Rows.Count+1).ToString this is for till last row to write formula in cell field

Which means that you write the same formula to whole range.
I recommend you to run in debug mode and check your flow.
Cheers

Oh yeah got it could you please help me with cell field what to write

I assume you use “For Each Row” loop.
Then use the output “Index” propperty which determines the datatable row index.
The WriteCell range should be then “H”+ cstr(Index+2)

Cheers

Thanks you but when i do this


getting this output
image

Hi @itsmegovardhan ,

In last screenshot, you have changed static cell address to dynamic but the value(formula) that you are using “C2” need to be change with C + CStr(index +2).

Use trim function