Diego_Pin
(Diego Pin)
November 29, 2019, 2:42pm
1
Hello Friends, I need a help here… I need calc the specifics values in columns (H,I,J,K) (with parameter: calc the column up until find a value in column (M))
Exp:I need calc the column H completely and put in a variable.
After find value in (M) I will to next row and begin a new calc.
TimK
(Tim Kok)
November 29, 2019, 2:51pm
2
Firstly read excel into a datatable, then use a for each row loop.
You can the do the calculation also with an if decision to check if
Not String.IsNullOrWhitespace(item(12).ToString)
This will check if column M is not empty - if true then do new calculation …
If you provide more understanding for requirements, I can try to help you more
Diego_Pin
(Diego Pin)
November 29, 2019, 6:30pm
3
Hello @TimK , with this (Not String.IsNullOrWhitespace(item(12).ToString)) I will just calc 12?
Because in my excel in the columns my values gonna change.
hi Diego_Pin,
can you please share the excel file… so, i can provide you the solution.
Diego_Pin
(Diego Pin)
November 29, 2019, 6:54pm
5
TimK
(Tim Kok)
December 2, 2019, 8:36am
6
if your column structure will stay the same, then what I have provided will look for column 12.
If you want to use column name which is more secure you can use -
Not String.IsNullOrWhitespace(item(“COLUMN”).ToString)
1 Like
Diego_Pin
(Diego Pin)
December 2, 2019, 12:44pm
7
Hello @TimK , Thnks man… can you do a explain how I can calculate that columns?
Is my first time doing this.
TimK
(Tim Kok)
December 2, 2019, 2:51pm
8
So is your calc to add the values or multiply the values etc?
You can add them by accessing each item and converting it to a double.
Inside the for each loop you can use this:
in an assign
Sum = CDbl(row.item(7).ToString)+CDbl(row.item(8).ToString)+…
You would then use the if statement with
Not String.IsNullOrWhitespace(row.item(12).ToString)
Store Sum in a list or something then start new calculation