I am quite new in Mathematica and I really need help with something ... I have an excel file with a total of 5332 rows and 6 columns. Column 1 is my focus of interest. The first 2666 data of column 1 are descending from 190 to 30 and the rest are ascending from 30 to 190. I would like to import the data (all six columns) of rows for which the column 1 data are ascending from 60 to 160. I have tried using "Select" without any success. I'm also not sure at all of using both "Import" and "Select" in combination. Any help will be greatly appreciated!!

Best Wishes Naz


1 Answer 1


Since you want ascending, and that depends on comparing pairs of items, we can group together each adjacent pair of items, test each pair to see if it qualifies and then take the first item from each pair.

First I make some fake data


And then use Partition to pair up the items, Select to decide if each pair is acceptable and finally Map[First to keep the first item and discard the second item of each pair.


the result from that is


There is a lot going on in that for someone who is new. See if you can look up each of those functions in the help system. # and & are parts of "anonymous functions", functions that don't even get given a name and are just used in that line and perhaps never again.

A different way of writing that might be easier for someone new to understand.


Try this on your actual data and see if it works. Make sure you have removed enough extra layers of {} that imported csv files sometimes have.

  • $\begingroup$ Hi Bill, I was so much into making my code work, I completely forgot to thank you, my sincere apologies!!!!! It worked perfectly. Thank you so very much again and Take Care man! $\endgroup$
    – NAZ001
    Oct 9, 2020 at 16:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.