Duplicate plus 2nd Column Action

Philip112

New Member
Joined
Mar 24, 2014
Messages
4
Hello Friends,

I have been going over code for the past week and have yet to get this, hoping that you could help.

I am looking for a formula that will:

1. Go through column A for duplicates.
2. If duplicate, then look to column B for a blank field.
3. If any of the duplicates in column B are blank, then delete entire A row for all duplicate numbers (or put a number in column c if that is easier then I can sort and delete)


So for example...

A B

3 Apples
4 Oranges
5 Bananas
3
6 Blueberries

For the example above, the formula would see that 3 is a duplicate in multiple spots, and seeing as in the 4th row there is a blank, it would delete both the first row that says Apples, AND the 4th row that has the blank field in B.

If the number 3 was duplicate in multiple spots, but there was never a blank spot in column B, then nothing would happen.

Does that make sense?

Thanks so much.

Philip
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
A formula aproach cannot modify A:B directly, create the appropriate results in C:D. Maybe someone into VBA can do the required processing in A:B directly.

I see, thanks for explaining. Yeah I thought with VBA, except I have no experience with that.

Even just the results in C:D would work, then I can sort and delete myself.
 
Upvote 0
I see, thanks for explaining. Yeah I thought with VBA, except I have no experience with that.

Even just the results in C:D would work, then I can sort and delete myself.

Not quite sure, but here is an interpretation...

3Apples4Oranges
4Oranges
5Bananas
5Bananas
6Blueberries
3
6Blueberries

<tbody>
</tbody>

C2, control+shift+enter, not just enter, and copy down:
Rich (BB code):
=IFERROR(INDEX($A$2:$A$6,SMALL(IF(FREQUENCY(MATCH($A$2:$A$6,$A$2:$A$6,0),
  ROW($A$2:$A$6)-ROW($A$2)+1)=1,
  ROW($A$2:$A$6)-ROW($A$2)+1),ROWS($C$2:C2))),"")

D2, just enter and copy down:
Rich (BB code):
=IF($C2="","",VLOOKUP($C2,$A$2:$B$6,2,0))
 
Upvote 0
Maybe this:

Layout

Col01Col02 Col01Col02
3Apples 4Oranges
4Oranges 5Bananas
5Bananas 6Blueberries
3
6Blueberries
**************************************
<colgroup><col width="42" style="width: 32pt; mso-width-source: userset; mso-width-alt: 1536;"> <col width="62" style="width: 47pt; mso-width-source: userset; mso-width-alt: 2267;"> <col width="17" style="width: 13pt; mso-width-source: userset; mso-width-alt: 621;"> <col width="42" style="width: 32pt; mso-width-source: userset; mso-width-alt: 1536;"> <col width="62" style="width: 47pt; mso-width-source: userset; mso-width-alt: 2267;"> <tbody> </tbody>

Formula

Code:
In D2 - use Ctrl+Shift+Enter to enter the formula

=IFERROR(INDEX(A$2:A$6,SMALL(IF(MMULT(--($A$2:$A$6=TRANSPOSE((COUNTIF($A$2:$A$6,$A$2:$A$6)>1)*($B$2:$B$6="")*$A$2:$A$6)),ROW($A$2:$A$6)^0)=0,ROW($A$2:$A$6)-ROW($A$2)+1),ROWS(D$2:D2))),"")

And copy to the right and down.

Markmzz
 
Upvote 0
Not quite sure, but here is an interpretation...

3Apples4Oranges
4Oranges5Bananas
5Bananas6Blueberries
3
6Blueberries

<tbody>
</tbody>

C2, control+shift+enter, not just enter, and copy down:
Rich (BB code):
=IFERROR(INDEX($A$2:$A$6,SMALL(IF(FREQUENCY(MATCH($A$2:$A$6,$A$2:$A$6,0),
  ROW($A$2:$A$6)-ROW($A$2)+1)=1,
  ROW($A$2:$A$6)-ROW($A$2)+1),ROWS($C$2:C2))),"")

D2, just enter and copy down:
Rich (BB code):
=IF($C2="","",VLOOKUP($C2,$A$2:$B$6,2,0))


Thanks Aladin, I had to make a small change to capture another rows data I didn't want to lose, but nailed it in the end. I appreciate it!

Philip
 
Upvote 0

Forum statistics

Threads
1,214,979
Messages
6,122,550
Members
449,088
Latest member
davidcom

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