Get a specific value under certain condition in Excel

Hi All,

I need to get time value under condition that Column B shows “Completed”,
Can I know how can I get this value and how to set the if condition that Column B is Completed.

I need this time value(variable) for future using.

Capture

Try below linq query

Dt.AsEnumerable().where(function(i) i.Field(Of String)(“Action”).Contains(“Completed”)).select(function(j) Cdate(j.Field(Of String)(“Time”)).ToString(“HH:mm”))

Can you give me a more specific step? many thx

Step1 : Read the Excel file by using Read range activity
step 2: The result stored in the Data table
Step 3 : use the Above Linq Query to get the result from the data table
Step 4 : Or you can iterate the Datatable through for each then you can check the Action column [Give If condition]
step 5 : if matching then get the value and convert to as time format…

Step 4 and 5 not required if you using the Linq Query. In Query itself everthing validated the condtion and get time format of result

for the step 3, should I use assign activity?

Im not sure how to get this result by using the Linq you provided

Use Assign and store that result

for step 4&5,
can you pls let me know how to set the condition for “completed” and then using Assign activity to get that time value

BlankProcess8.zip (16.6 KB) Refer this code

thx you for your helping. but what if I just want the time value of very first “completed”.

cuz in the future automation, there will be many rounds “completed” log in the Excel, and I just need the first one

Hi @mason_wong,

i just filter all “Completed” Status , if you want the first one ,in foreach after getting value just give break statement or you can apply our own logic to find the top one.

1 Like

Hi Prakaz. thank you so much for your help.

I have tried the break statement but it not worked. could you pls let me know how can I get the top one value?

Appreciate it

1 Like

I used count= items.count, and I guess the first item can be obtained by items(0)

But it shows error

1 Like

I just fixed the issue. many thx

1 Like

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