Get all the below excel values after if statement

Hi, I want to do for each row(“Date”). Then, if row(“Date”) contains the first business day of April 21. Then, get the average from first business day of April to the end of rows(“Amount”). How can this be accomplish?

One suggestion is

  1. First sort the excel with the Date
    2)Use first\Last row activity to get the last row of the excel
    3)in the if condition as per your logic if a month starts with April, then get the index of the cell.
    4)Then fill range activity to find the sum( using the index of the first identified row and the last row in the excel)

Hope this will work in your case

Main (1).xaml (14.9 KB)



@RPA_Path Based on if condition once you get the cell position use a read range to read from there and calculate the sum using data aggregation activities available

Thank you. Also, how would I get the average of last 3 rows?

1 Like
  1. dtLast3= dt.asenumerable.reverse().Take(3).CopyToDataTable

  2. average = dtLast3.AsEnumerable.Average(function(row) cdbl(row("Amount").ToString))

1 Like

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