Excel column with 'if' condition

hi, i need to automate the steps:

1.read an excel column ‘cost’.
2.provide the cell (within cost column) color if the cell is >= 4.00

below is the img of cost column.

can anyone plz help! it’s urgent!

this is what we’ve tried so far…

image image


Initiate a counter = 1

  1. Read column or read range

  2. iterate it through using For each or For each row in case of datatable(if u use read range)

  3. Assign and increment counter = counter +1

  4. check if the item > 4.0

If greater than 4.0 then use excel application scope and inside it use get cell colour and Provide the column name and “D”+Counter.tostring

I have done a sample workflow and attached here

Sequence1.xaml (8.5 KB)

i’m sorry what is “cdb” in condition-the last step?

when u read the column , it will be of type collection of object. so i am casting it into double for comparing it with 4.0

i get this error

Hi @new_user - Try convert.ToDouble(cdb(item).ToString) >= 4.0


not working. :frowning:

This one - Try convert.ToDouble(cdb(item.ToString)) >= 4.0


it is “cdbl” and not cdb

use the expression as cdbl(item) , this will work . I have put the same in the xaml workflow which i provided

oh !! okay…tried putting that and it’s not providing the cell color :frowning:

attaching the file ExcelApplicationScope.xaml (9.6 KB)

@new_user ExcelApplicationScope.xaml (8.6 KB) i made some modifications to your code buddy,just go through it,let me know if any thing goes wrong.

ExcelApplicationScope.xaml (10.0 KB)

please try this workflow :slight_smile:

1 Like

did it work for u?

1 Like

not working for me :frowning:

1 Like

not wrking :frowning: i think “cost” is a column name in the excel…i tried changing instances of “row” to “column” but it gives an error :frowning:

1 Like

@new_user can I have the screenshot of that,actually it has to work.

1 Like

i have few doubts, could u plz clarify?

  1. counter =15 means?
1 Like


  1. It gives me the following message box for cells not satisfying the condition. (img 1)
  2. When the condition is satisfied i.e. score ‘4.10’ is greater than ‘4.00’, then it gives color (white). However , it should display green not and white (img2)


1 Like