How can I print the totals of the last two columns separately in the “Total Result” Line in the last row in Excel?
and how can I do this dynamically.
Thank you
How can I print the totals of the last two columns separately in the “Total Result” Line in the last row in Excel?
and how can I do this dynamically.
Thank you
CAn You Put the screenshot of your requirement means input and output it is easy to understand better
Hi @robotica
Try this
Amount=DT1.AsEnumerable().Sum(Function(row) row.Field(Of Double)("Amount")).ToString
Price=DT1.AsEnumerable().Sum(Function(row) row.Field(Of Double)("Price")).ToString
Write Cell1: "A"+(DT1.RowCount+2).ToString
Write Cell2: "B"+(DT1.RowCount+2).ToString
Input:
Output:
Cheers!!
Hi @robotica
Input:
Amount= Convert.ToDouble((From row In dt.AsEnumerable() Select Convert.ToDouble(row("Amount"))).Sum())
Price= Convert.ToDouble((From row In dt.AsEnumerable() Select Convert.ToDouble(row("Price"))).Sum())
Amount and Price variable are of DataType System.Double
Output:
Hope it helps!!
Thank you for your interest. However, I want to do these in a frame structure. Some rows correspond to different cells. The names of my last two columns are “Amount” and “Total” respectively.
For each downloaded excel file
I want to print the total of the last two columns in the Total Amount Row. I’m new to this. I don’t know how to do this. And in some downloaded Excel files, the “$” column and the “Stock” column do not come in the same cell. So column “$”(J) can sometimes be in column “H”.
Thank you
excel.xls (35.3 KB)
For each downloaded excel file
I want to print the total of the last two columns in the Total Amount Row. I’m new to this. I don’t know how to do this. And in some downloaded Excel files, the “$” column and the “Stock” column do not come in the same cell. So column “$”(J) can sometimes be in column “H”.
Thank you
excel.xls (35.3 KB)
Hi @robotica
Input:
Amount= Convert.ToDouble((From row In dt.AsEnumerable() Select Convert.ToDouble(row("$"))).Sum())
Price= dt.AsEnumerable().
Where(Function(row) Not String.IsNullOrEmpty(row("Stock").ToString())).
Select(Function(row) Convert.ToDouble(row("Stock"))).
Sum()
Amount and Price variable are of DataType System.Double
Output:
Hope it helps!!
You can directly inserts the formula in through UiPath in the endline of excel for sum(=sum[A:A])