Hello everyone,
I want to sum the data in the excel table in the picture, then I will take the average of this sum and print it in column C1 in the same excel file. what should I do?
note: the data in the excel file is printed as a string, not as int
I apologize for my bad English.
Project.zip (463.2 KB)
Vikas_M
(Vikas M)
July 30, 2023, 2:12pm
2
emir_ozsimsir:
I want to sum the data in the excel table in the picture, then I will take the average of this sum and print it in column C1 in the same excel file. what should I do?
note: the data in the excel file is printed as a string, not as int
Hey @emir_ozsimsir , Please refer below file
BlankProcess1.zip (19.9 KB)
Hope it helps you !
1 Like
ppr
(Peter Preuss)
July 30, 2023, 2:20pm
3
This HowTo gives an introductory overview of the aggregation Operators: Min, Max, Sum, Average
Introduction
The aggregation operators are used to retrieve from a collection a particular result by setting the contained items into a relationship.
Overview
I – Input
P – Processing
O – Output
{2,12,-8,6,14,5}
get the lowest value
-8
{2,12,-8,6,14,5}
get the highest value
14
{2,12,-8,6,14,5}
sum up all values
31
{2,12,-8,6,14,5}
get the average of all values
5.17
Constraints
P…
VB:
mySum | Datatype: Double = DtVar.AsEnumerable().Sum(Function (x) CDbl(x(“fiyat”).toString.Trim))
C#:
DtVar.AsEnumerable().Sum(x => Convert.ToDouble(x["fiyat"].ToString().Trim()))
1 Like
thank you very much sir it worked. but I cannot print it to excel because the data type is not data table, do you have any suggestions?
Vikas_M
(Vikas M)
July 30, 2023, 2:25pm
5
You can use write cell activity and add it in the excel
Define the cell and it will write
1 Like
ppr
(Peter Preuss)
July 30, 2023, 2:30pm
6
When the localization plays a role (dot is group seperator) we can do
Int32.Parse(YourString, System.Globalization.CultureInfo.CreateSpecificCulture("tr-TR"))
Double.Parse(YourString, System.Globalization.CultureInfo.CreateSpecificCulture("tr-TR"))
2 Likes
I’m sorry, I don’t fully understand what exactly these codes are for, can you explain a little more?
lrtetala
(Lakshman Reddy)
July 30, 2023, 4:00pm
8
Hi @emir_ozsimsir
Please find below xaml for your reference
BlankProcess5.zip (164.0 KB)
O/P Excel:
FORD.xlsx (14.2 KB)
I hope it helps!!
1 Like
Thank you very much, this is exactly what I was trying to learn. can you explain why you are using if else?
lrtetala
(Lakshman Reddy)
July 30, 2023, 4:44pm
10
@emir_ozsimsir
Please find this xaml it contains two methods
BlankProcess5.zip (172.9 KB)
1 Like
lrtetala
(Lakshman Reddy)
July 30, 2023, 4:49pm
11
@emir_ozsimsir
Method1:
In the given excel file it contains 1.100.000 so if we perform addition it doesn’t supports that’s why i am using if condition to filter it.
In 2nd method @ppr suggested conditions are helpful to read all values and performing addition.
So, better to use 2nd method because it reads all values to perform addition.
1 Like
I’ve learned a lot thanks to you
1 Like
system
(system)
Closed
August 2, 2023, 5:10pm
13
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.