Multiply column in excel with 50 using LINQ query

Hello,

I am trying to multiply column “A” with 50 and write the result in “Result” Column.

With the total of the Result .

image

can any one help me how i can do that with LINQ Query

Thank you

1 Like

Hi @coder

Try this

[HowTo] - First Start with LINQ (VB.Net)

Thanks
Ashwin.S

1 Like

Hey @coder

Please find the demo below,

nmnithinkrishna_AddInUpdateXLCol.zip (9.7 KB)

Hope that helps.

Thanks
#nK

1 Like

Thank you @AshwinS2

Thank you @Nithinkrishna

1 Like

Cool @coder :slight_smile: :+1:

@Nithinkrishna could you please explain to me what you are doing in the assign?

Thank you

1 Like

Could you please show me the snap to check which Assign you are saying ?

1 Like

@Nithinkrishna Sure,

`

dt_Data.AsEnumerable.Select(Function(row) dt_DataCopy.Rows.Add(row.ItemArray.Take(dt_Data.ColumnCount - 1).ToArray.Concat(if(String.IsNullOrEmpty(row(“A”).ToString.Trim),{string.Empty},{CStr(CInt(row(“A”).ToString)*50)})).ToArray)).CopyToDataTable

And this

dt_DataCopy.Rows(dt_Data.RowCount-1).Item(dt_Data.ColumnCount-1)

=

dt_DataCopy.AsEnumerable.Select(Function(row) CInt(if(String.IsNullOrEmpty(row.ItemArray.Last().ToString),0,row.ItemArray.Last))).Sum

1 Like

Okay in the first Assign we are recreating the Data Table by updating the output column with calculation.

Second assign is to update the total value of it in the last row last column.

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