About Excel's 'Sort and Filter'

I hope this message finds you well.

I have a table as shown in the images below, and I would like to apply a “User-defined Sort” for each item like “aaa”, “iii”, “uuu” under “Sort and Filter”. Is there a way to implement this?

I would greatly appreciate your guidance on this matter.
Thank you very much in advance.

For Excel processing like this:

  1. Use the Read RangeX activity to read Excel into a data table.
  2. Process the data table with LINQ.
  3. Output the results to Excel with the Write RangeX activity.

This makes it easy.
While LINQ might seem a bit challenging at first, it’s just a matter of getting used to it. I was the same way at first. If you’re unsure, you can ask a generative AI about LINQ syntax, and it can help you understand the syntax better, so the barrier is lower than it used to be.
It seems that comprehensive information on data table operations using LINQ will be covered in a UiPath explanation book scheduled to be published by Ohmsha this year at the end of the year, so it might be good to take a look at it.

For simple processes, you can also use the SELECT method without needing to utilize LINQ.

Hello

Depending on your requirements, do you want to sort other items without sorting by product name?

If the product names are grouped (the same items appear in consecutive rows together, while some are missing), I think the following will work.

dt.AsEnumerable.GroupBy(Function(r) r("品名").ToString).SelectMany(Function(g) g.OrderByDescending(Function(r) Decimal.Parse(r("価格").ToString)).ThenByDescending(Function(r) Decimal.Parse(r("調整").ToString))).CopyToDataTable()

Sample
Sample20260611-3.zip (10.6 KB)

If there are cases where the same item is skipped, you might need a logic that scans from the top.

@gorby

Thank you for your reply.
I wasn’t familiar with it and had never used it, so I’ll take this opportunity to study it.

@Yoichi

Thank you for your consistent responses.
Also, thank you for the sample flow.

I am trying to solve this using only activities, but I am struggling.
So far, I have been able to use a loop to compare the current row in the DataTable with the next row and retrieve the expected range, but it has become quite lengthy, so I am exploring other methods.

I am also considering trying to extract one item at a time from the DataTable using a filter activity.

It becomes a very simple operation using LINQ. The keyword is Where. For your reference.

I think there are several methods, but if we create an activity using the approach of scanning through a DataTable, it might look something like the following.

Sample
Sample20260611-3 (2).zip (11.2 KB)