Hello,
I am trying to calculate the difference between the values in two or more columns (in 2 sheets). I pulled data from excel files in the database and for calculating values in 2 columns I am using the following formula:
The formula works fine in cases when some values are assigned in each column, But whenever there is value in missing, the column with results stays empty. Here is an example:
you can use the if condition to check whether the column value is empty or not before proceeding with the comparison. apply the formulae if both columns are not null.
Ex: dt_SLB_Page1.Rows(int_counter_row).Item(0).toString <>“” and Convert.ToDouble(dt_FI_Page1.Rows(int_counter_row).Item(0).toString <> “”
In other case where the column is null you keep the column data which is not null in the comparison.
Thanks,
I got it. But there is additional question;)
The cells those are not compared (have value only in one column) are saved as text entries in Excel. How can I prevet this - same the as numbers?
Elese formula is: convert.ToString(dt_SLB_Page1.Rows(int_counter_row).Item(0).toString +dt_FI_Page1.Rows(int_counter_row).Item(0).toString)