How to Check Excel 2 null or empty Columns

How to check Column A null or empty value then need answer in C column in the result.
So I should check if ColumnA is null value and column b is value then result is c columnBook1.xlsx (8.5 KB)

Hi @Abubakkar

You can first use the Read Range activity to read the excel onto a datatable variable
Then use a For Each Row activity to loop through the data table.

In the loop, you can check whether the column A is null by the below command.
This will return a true or false, so you can use it in a IF condition.

To add a value to column C:
in the same loop, use an Assign activity

row("Result") = "The Value You Want to Assign or the Variable"

Then Finally, once you get out of the loop, use a Write Range activity to write the data back to the excel

Hope it helps!!

Let know whether this works out for you.

1 Like

Hi @Lahiru.Fernando
Thanks for your help.Can you find where can i mistake it ?
Main.xaml (15.2 KB)

for your references

Hi @Abubakkar

You are getting that error because result1 data table is null and not initialized to anything

For you to perform a write range with result1, it should contain data and cannot be null

What should I change this error ? Can i give some value for result2 or change variable scope what should i do
Can you tell me how to execute this process?

What was the idea you had to put that assign activity there? I mean, why did you have result1 and what were you trying to do there?

Result is variable name of C column if i give result variable directly in write range the error is generic variable cannot be converted string, So only I was assigning result is generic convert to string result1 but i think that problem is scope in write range activity

Just i need answer in C column “Actions is Invalid”
compare to null and value

is it this what you need as the output?

1 Like

Exactly @Lahiru.Fernando:smiley:

Did a slight change. Took the write range activity out of the loop and added as a different step in the flowchart.

and the assign activity we were talking about, I changed it to assign the value you need.

Main.xaml (15.3 KB)

1 Like

yeah Now it’s working properly. I should aware in Assigning to variable data value. it was great help from you . Thank you so much @Lahiru.Fernando

1 Like

HI @Lahiru.Fernando,
Again i got an error because i need a solution for the following condition:
Action is null and material id is null then result is Invalid
Action is value and material id is null then result is Material id is invalid
Action is null and material id is value then result is action id is invalid
Action is value and material id is value then result is action id is created

Main01.xaml (23.9 KB)

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