I have a list of values in EXCEL
X Y
5 3000
5 3200
5 2800
10 1600
10 2900
10 3500
15 1800
15 4500
I want to get the list of X without duplicates and corresponding MIN / MAX values Y. Something like this for MAX values:
X Y
5 3200
10 3500
15 4500
How do I proceed?
Have a look at PowerQuery
:
Data
tab, then > From Table/Range
.From Table
dialog box, you can click the Range Selection
button to select a specific range to use as a data source.My table has headers
. The header cells are used to define the column names for the query. Within PowerQuery
AKA Get&TransForm
Transform
tab, then > Group by
.Advanced
and under Group by
you choose X
New column name
, eg: maxVals
. Furthermore choose Max
as an Operation
and under Column
you choose Y
.OK
and close PowerQuery
. You'll now end up with your desired output. Replicate this for the minVals
.
For MAX values you could sort your data: column X ascending & column Y descending and then apply an advanced filter (only to column X), checking the option for unique values only for MIN values you repeat the process but specify ascending as the sort order for column Y Recording macros of these actions will provide you with the VBA code, which you should be able to make dynamic as you are asking your question in a Lecture after the Sections on Variables and Range References.
I hope this will be helpful
Will you do this more than once or multiple times?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.