I have a spreadsheet with 100 columns and 5000 rows, which I imported into Mathematica as a list named data.
First, I select all rows whose 47th element is 2021:
list1 = Select[data,#[[47]]==2021 &]; Then I get the minimum value of all elements in column 89th in list1:
min=Min@list1[[All,89]]; Finally, I would like to display all rows in my original data whose 47th element is 2021 and 89th element is the above minimum:
Select[data,#[[47]]==2021 && #[[89]]==min &] I don't really like this approach. My question: Do we have another better way to achieve the same result?
If the data has fewer columns like 3 or 4 then I found a solution using Cases. Can we use Cases in my case?
>=min? $\endgroup$Caseswith fewer columns. Why can it not be extended? $\endgroup$MinimalBy[#[[89]] &] @ Select[#[[47]] == 2021 &] @ datado what you want? $\endgroup$