Formula to Extract Highest Unique from 2 Columns

TheCobbler

New Member
Joined
Aug 21, 2021
Messages
49
Office Version
  1. 365
Platform
  1. Windows
Hi,

I'm looking for a fomula to help me extract the highest unqiue value in a 2 column list.
I need a unique value from column B but it has to be the highest relevant value in column A.

Example below of the desired result. Columns A & B to become C & D.

Thanks as always for any help and guidance,
Cobb

ABCD
1.554.741.554.74
1.605.492.305.49
1.655.492.505.74
1.705.49
1.755.49
1.805.49
1.855.49
1.905.49
1.955.49
2.005.49
2.055.49
2.105.49
2.155.49
2.205.49
2.255.49
2.305.49
2.355.74
2.405.74
2.455.74
2.505.74
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Like this?

23 08 15.xlsm
ABCD
1ABCD
21.554.741.554.74
31.65.492.35.49
41.655.492.55.74
51.75.49
61.755.49
71.85.49
81.855.49
91.95.49
101.955.49
1125.49
122.055.49
132.15.49
142.155.49
152.25.49
162.255.49
172.35.49
182.355.74
192.45.74
202.455.74
212.55.74
TheCobbler
Cell Formulas
RangeFormula
C2:D4C2=LET(u,UNIQUE(B2:B21),HSTACK(BYROW(u,LAMBDA(r,TAKE(SORT(FILTER(A2:A21,B2:B21=r)),-1))),u))
Dynamic array formulas.
 
Upvote 0
How about
Fluff.xlsm
ABCD
1ABCD
21.554.741.554.74
31.65.492.35.49
41.655.492.55.74
51.75.49
61.755.49
71.85.49
81.855.49
91.95.49
101.955.49
1125.49
122.055.49
132.15.49
142.155.49
152.25.49
162.255.49
172.35.49
182.355.74
192.45.74
202.455.74
212.55.74
22
Data
Cell Formulas
RangeFormula
C2:D4C2=LET(u,UNIQUE(FILTER(B2:B100,B2:B100<>"")),HSTACK(XLOOKUP(u,B2:B100,A2:A100,,0,-1),u))
Dynamic array formulas.
 
Upvote 1
Glad we could help & thanks for the feedback.
 
Upvote 0
Both perfect.
Note that they return different results if it was possible that column A is not always increasing.

23 08 15.xlsm
ABCDEFG
1ABCD
21.554.741.554.741.554.74
31.65.49205.492.35.49
41.655.492.55.742.55.74
51.75.49
61.755.49
71.85.49
81.855.49
9205.49
101.955.49
1125.49
122.055.49
132.15.49
142.155.49
152.25.49
162.255.49
172.35.49
182.355.74
192.45.74
202.455.74
212.55.74
TheCobbler (2)
Cell Formulas
RangeFormula
C2:D4C2=LET(u,UNIQUE(B2:B21),HSTACK(BYROW(u,LAMBDA(r,TAKE(SORT(FILTER(A2:A21,B2:B21=r)),-1))),u))
F2:G4F2=LET(u,UNIQUE(FILTER(B2:B100,B2:B100<>"")),HSTACK(XLOOKUP(u,B2:B100,A2:A100,,0,-1),u))
Dynamic array formulas.


.. and if column A is always increasing & column B grouped as per your sample then you would only need this

23 08 15.xlsm
ABCD
1ABCD
21.554.741.554.74
31.65.492.35.49
41.655.492.55.74
51.75.49
61.755.49
71.85.49
81.855.49
91.95.49
101.955.49
1125.49
122.055.49
132.15.49
142.155.49
152.25.49
162.255.49
172.35.49
182.355.74
192.45.74
202.455.74
212.55.74
22
TheCobbler
Cell Formulas
RangeFormula
C2:D4C2=FILTER(A2:B21,B2:B21<>B3:B22)
Dynamic array formulas.
 
Upvote 0
Solution
Book1
ABCDE
11,554,741,554,74
21,65,492,35,49
31,655,492,55,74
41,75,49
51,755,49
61,85,49
71,855,49
81,95,49
91,955,49
1025,49
112,055,49
122,15,49
132,155,49
142,25,49
152,255,49
162,35,49
172,355,74
182,45,74
192,455,74
202,55,74
Sheet1
Cell Formulas
RangeFormula
D1:E3D1=LET(x,UNIQUE(B1:B20),HSTACK(MAXIFS(A1:A20,B1:B20,x),x))
Dynamic array formulas.
 
Upvote 0
Note that they return different results if it was possible that column A is not always increasing.

23 08 15.xlsm
ABCDEFG
1ABCD
21.554.741.554.741.554.74
31.65.49205.492.35.49
41.655.492.55.742.55.74
51.75.49
61.755.49
71.85.49
81.855.49
9205.49
101.955.49
1125.49
122.055.49
132.15.49
142.155.49
152.25.49
162.255.49
172.35.49
182.355.74
192.45.74
202.455.74
212.55.74
TheCobbler (2)
Cell Formulas
RangeFormula
C2:D4C2=LET(u,UNIQUE(B2:B21),HSTACK(BYROW(u,LAMBDA(r,TAKE(SORT(FILTER(A2:A21,B2:B21=r)),-1))),u))
F2:G4F2=LET(u,UNIQUE(FILTER(B2:B100,B2:B100<>"")),HSTACK(XLOOKUP(u,B2:B100,A2:A100,,0,-1),u))
Dynamic array formulas.


.. and if column A is always increasing & column B grouped as per your sample then you would only need this

23 08 15.xlsm
ABCD
1ABCD
21.554.741.554.74
31.65.492.35.49
41.655.492.55.74
51.75.49
61.755.49
71.85.49
81.855.49
91.95.49
101.955.49
1125.49
122.055.49
132.15.49
142.155.49
152.25.49
162.255.49
172.35.49
182.355.74
192.45.74
202.455.74
212.55.74
22
TheCobbler
Cell Formulas
RangeFormula
C2:D4C2=FILTER(A2:B21,B2:B21<>B3:B22)
Dynamic array formulas.

Thanks for highlighting this. They will be 'if column A is always increasing & column B grouped as per your sample then you would only need this'. I've given all these a test and it's very interesting to see the differences. I've currently implemented your shortened filter but there's a lot of new functions for me to digest here! Thank you again for sharing your knowledge.
 
Upvote 0
You're welcome. Glad we could help. Thanks for the follow-up. :)
 
Upvote 0

Forum statistics

Threads
1,223,703
Messages
6,173,973
Members
452,540
Latest member
haasro02

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top