ozgesdvc
(Ozgesdvc)
January 3, 2021, 3:46pm
1
Hi everyone,
I am trying to get a data from a car selling website and average of first 100 ads’ car’s KM and price. Like in the below:
After finding average of 100 ads’ price and KM, I want to write it an excel cell which belongs to specific car brand.
How can I write an average of these ads to write cell activity ? Could you help me ?
Hi @ozgesdvc
Welcome to forum
Can u show the excel file where u need to write the avg?
ozgesdvc
(Ozgesdvc)
January 3, 2021, 4:11pm
3
Thank you Nived. This is the excel file ss:
ozgesdvc
(Ozgesdvc)
January 3, 2021, 4:13pm
4
Also this is the my uipath sequence:
Hi @ozgesdvc
For calculating the average u can use the below linq query
ExtractDataTable.AsEnumerable(). Average(Function(row) Cint(row (“columnname”)))
2 Likes
ozgesdvc
(Ozgesdvc)
January 3, 2021, 4:46pm
6
Dear Nived,
Thank you for your help. It is working for KM because it’s all number. But it is not working in price because it contains “TL”.
It gives this error:
Write Cell: Conversion from string “200.000 TL” to type ‘Integer’ is not valid.
How can I fix this? Thank you.
Hi @ozgesdvc
Try this
ExtractDataTable.AsEnumerable(). Select (Function (row) row(“ColumnName”).ToString.Replace(“TL”,“”)).CopyToDatatable.AsEnumerable().Average(Function (row) CDbl(row(“ColumnName”)))
ozgesdvc
(Ozgesdvc)
January 3, 2021, 5:16pm
8
It gives:
‘CopytoDatatable’ is not a member of ‘System.Data.EnumerableRowCollection(of String)’ error.