I have the Excel data shown below. Column A has the ID, columns B and C have segments of values associated with the ID, and Columns D and E are general descriptions of the ID (associated with the ID, not individual segments). The data has about 600 IDs and is about 1000 rows long.
| ID | Value 1 | Value 2 | Descr 1 | Descr 2 |
|---|---|---|---|---|
| 11 | 2.5 | 1.8 | a | x1 |
| 11 | 2.3 | 1.1 | a | x1 |
| 11 | 1.9 | 1.6 | a | x1 |
| 12 | 3.7 | 3.5 | b | x2 |
| 12 | 3.9 | 1.5 | b | x2 |
| 13 | 2.5 | 0.2 | c | x3 |
| 13 | 2.6 | 4.1 | c | x3 |
| 13 | 2 | 4.8 | c | x3 |
| 13 | 2.7 | 1.8 | c | x3 |
I am trying to create a single row for each ID. This row will add up values in columns B and C, and delete repeated descriptions, wherever the ID matches in column A.
I have tried using SUMIF, but I can't figure out how to automate that over the entire row of data. I believe there should be a better function/method to do this. Expected is a table with unique ID, values, and description.
| ID | Value 1 | Value 2 | Descr 1 | Descr 2 |
|---|---|---|---|---|
| 11 | 6.7 | 4.5 | a | x1 |
| 12 | 7.6 | 5.0 | b | x2 |
| 13 | 9.8 | 10.9 | c | x3 |
Edited
@Ike Solution below worked for me. I was trying to get max value 1 and min value 2 for each ID. I edited Ike Solution to below, but it threw up a #Value! error
=LET(data,A1:E10,
uIDs, UNIQUE(CHOOSECOLS(data,1,4,5)),
aValues, MAKEARRAY(ROWS(uIDs), 1, LAMBDA(r,c, MIN(IF(INDEX(data,,1),INDEX(uIDs,r,1),INDEX(data,,c+1))))
),
bValues, MAKEARRAY(ROWS(uIDs), 1, LAMBDA(j,k, MAX(IF(INDEX(data,,1),INDEX(uIDs,j,1),INDEX(data,,k+1))))
),
CHOOSECOLS(HSTACK(uIDs,aValues, bValues),1,4,5,2,3))
If applicable one could use
GROUPBY()works withMS365for Beta Versions.MSFT Documentations: GROUPBY or PIVOTBY
Edit: As per the new update by OP
Using One
LAMBDA()Helper FunctionMAKEARRAY()withAGGREGATE()function to get the desired output ofMIN&MAXvalues:Also for
MAXandMINone needs to interchange the function_num in theAGGREGATE()function:Test Case:
Edit: Forgot to use
CHOOSECOLS()so here is an updated version: