For example, I Have atttached excel sheet. In this i need to sum the mark1, mark2 and mark3 values and put in the total (column name) also calculate the percentage(column name) in the same excel sheet.

how can i do this?

Merge.xlsx (7.7 KB)

Hi @jamunatj

Use for each row

Use row(â€śtotalâ€ť). ToString=row(0). ToString+row(1). ToString+row(2). ToString

Use row(â€śPercentageâ€ť)=row(total).ToString/3

Then use write range to print the total and Percentage

Thanks

Ashwin.S

How to add the null value in sixth row and eight row while running it showing like this Merge.xlsx (7.7 KB)

Based on this you are getting error right

Thanks

Ashwin.S

yes ,while running it showing

object cannot be cast from DBnull to the other types .

Try like below

Use assign activity for these below things

row(â€śtotalâ€ť)=Convert.Toint32(row(0).ToString)+Convert.Toint32(row(1).ToString)+Convert.Toint32(row(2).ToString)

```
row(â€śPercentageâ€ť)=Convert.Toint32(row(total).ToString)/3
```

If you have decimal numbers, use Convert.ToDouble instead of Convert.ToInt32

Merge.xlsx (7.7 KB)

How to add the null value in sixth row and eight row while running it showing

object cannot be cast from DBnull to the other types

I have followed like this

row(â€śtotalâ€ť=(Convert.ToInt32(row(â€śMark1â€ť))+Convert.ToInt32(row(â€śMark2â€ť))+Convert.ToInt32(row(â€śMark3â€ť))).ToString

@jamunatj Try like below

` row("Total")=(Convert.ToInt32(if(row(â€śMark1â€ť).Tostring<>"",row(â€śMark1â€ť),0))+Convert.ToInt32(if(row(â€śMark2â€ť).Tostring<>"",row(â€śMark2â€ť),0))+Convert.ToInt32(if(row(â€śMark3â€ť).Tostring<>"",row(â€śMark3â€ť),0)))`

Its working. Thanks.