To add the values in each row and paste it at the end of the column

Hi all,

To add the values in each row and paste it at the end of the column.

Example:

Rowid. A B
Id1 3 2
Id2 1 4
Total 4 6

Any idea?

Thanks in advance!

Hi,

Hope the following helps you.

Sequence.xaml (7.3 KB)

Regards,

Hi @Yoichi ,

The columns are dynamic. The excel might contain 2 column or more the 2.
I just gave in an example.

Is there any way?

Thanks in advance!

Hi,

How about the following?

Sequence.xaml (8.9 KB)

Regards,

Hi @Yoichi ,

There is an error in the second assign.
It may be because few cells are empty in the sheet?
And the cell value - ‘total’ isn’t present in the input sheet. I’ve added it.

It’s how the output sheet should look.

The error states - input string was not in a correct format.
Any idea?

Thanks in advance!

Hi,

It may be because few cells are empty in the sheet?

It causes error. Can you modify it as the following?

listObj=listObj.Concat(tempDt.Columns.Cast(Of DataColumn).Select(Function(c) tempDt.AsEnumerable.Sum(Function(r) if(Int32.TryParse(r(c).ToString,New Int32), Int32.Parse(r(c).ToString),0))).Select(Function(x) CType(x,object))).ToList

Regards,

Hi @Yoichi,

Solves the query.
Thank you

1 Like

Hi @Yoichi ,

Can you please help me out in getting the transpose of excel using LINQ?
I’m getting it through activities, but takes a lot of time. So trying to achieve it through LINQ.

Thanks in advance.

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