Remove lesser of values in one column where duplicates exist in another

SeanMcBride

New Member
Joined
Oct 28, 2017
Messages
2
Here's the scenario:
[TABLE="width: 500"]
<tbody>[TR]
[TD]Column A[/TD]
[TD]Column B[/TD]
[TD]Column C[/TD]
[TD]Column D[/TD]
[/TR]
[TR]
[TD]14[/TD]
[TD]195[/TD]
[TD]Skeleton[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]14[/TD]
[TD]195[/TD]
[TD]Skeleton[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]17[/TD]
[TD]32787[/TD]
[TD]Costume[/TD]
[TD]Fales[/TD]
[/TR]
[TR]
[TD]17[/TD]
[TD]5695[/TD]
[TD]Costume[/TD]
[TD]True[/TD]
[/TR]
[TR]
[TD]17[/TD]
[TD]698974[/TD]
[TD]Costume[/TD]
[TD]False[/TD]
[/TR]
[TR]
[TD]23[/TD]
[TD]30073[/TD]
[TD]Witch[/TD]
[TD]False[/TD]
[/TR]
[TR]
[TD]23[/TD]
[TD]2757[/TD]
[TD]Witch[/TD]
[TD]True[/TD]
[/TR]
[TR]
[TD]23[/TD]
[TD]999999[/TD]
[TD]Witch[/TD]
[TD]False[/TD]
[/TR]
</tbody>[/TABLE]

In a worksheet with over 10,000 lines, I'm trying to create a formula or macro to select the higher value in column B where duplicates exist in Column A. For example, Column A has three duplicates of 17. I would want the formula to denote which value of those duplicates n Column B is the lesser of all the duplicates by some indicator. In other words, if duplicates in Column A exist, select the lesser corresponding value of that series in Column B. Help!
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Howdy! Could you elaborate on what you want with the result? Do you want the formula to be filled across the entire data range, and where there are duplicates in A, the result of the formula is the minimum corresponding value in B for all duplicates?

You've also said
I'm trying to create a formula or macro to select the higher value in column B where duplicates exist in Column A.
Is this a typo?
 
Upvote 0
Yes, that's a typo. I would want the formula to select the lesser value of the duplicates. And yes, the formula could be copied down the whole data range. I could then sort the data and where the lesser value is indicated, sort, and easily have all lesser values.
 
Upvote 0
Assuming you have column headings, try in cell E2
=MIN(IF(A:A=A2,B:B))

And press CONTROL+SHIFT+ENTER, as it's an array formula. Then fill down the data set. That should give you the minimum of all B values with the corresponding A value. This will create duplicates, which might be a pain for your sorting... is that a problem?
 
Upvote 0
Just preempting your response haha... I've modified the formula so that it'll only show the result the first time. This means when you sort by the lesser values you will get a shortlist without duplicates, assuming that's what you'd like! Again, make sure to press CONTROL+SHIFT+ENTER

=IF(ROW()=MATCH(MIN(IF(A:A=A2,B:B)),IF(A:A=A2,B:B),0),B2,"")

EDIT: Fixed formula to make sure it only returned minimums for the duplicates in column A
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,828
Messages
6,181,204
Members
453,022
Latest member
RobertV1609

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