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:
Column AColumn BColumn CColumn D
14195Skeleton
14195Skeleton
1732787CostumeFales
175695CostumeTrue
17698974CostumeFalse
2330073WitchFalse
232757WitchTrue
23999999WitchFalse

<tbody>
</tbody>

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

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
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,221,448
Messages
6,159,922
Members
451,604
Latest member
SWahl

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