Please solve this

i need to calculate how many “p” available and need output in k column Result =4
i need to calculate how many “t” available and need output in L column Result =2
i need to calculate how many “y” available and need output in M column Result =2
i need to calculate how many “r” available and need output in N column Result =2

output like
excel 2

use Read Range to read the data in Datatable and create counter variable for the letters you have to get the count for, initialize then to zero

Loop through datatable keep the variable counter incrementing for the values as you find any letter in the row in loop

If this a sample data you making up to ask the question?
Also, if u want to do it i an excel using macro. Just use =Count(“p”,A1:J1) and ssme for all letters you want the count of.

@srinivasmarneni

Use write Cell activity and check below for your reference

If you want to write for multiple records then use For Each Row activity and you can declare a variable for Index of For Each Activity

Assign IndexVariable = IndexVariable + 2

Now in the E1 place write as E+IndexVariable.ToString

and in Expression “=COUNTIF(A”+IndexVariable.ToString +“:”+“D”+IndexVariable.ToString+“)”

Hope this may help you thanks

1 Like

Hi,

Another solution:

If you need to calculate the above result by not excel formula but UiPath, the following might help you.

dict = dt.Rows(0).ItemArray.GroupBy(Function(o) o.ToString).ToDictionary(Function(g) g.Key,Function(g) g.Count)

Sample20211009-1.zip (7.0 KB)

Regards,

1 Like

thank you

1 Like

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