Countif or macro option

shre0047

Board Regular
Joined
Feb 3, 2017
Messages
53
Office Version
  1. 365
Platform
  1. Windows
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Check[/TD]
[TD]Status[/TD]
[TD]ID[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Valid[/TD]
[TD]123[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Valid[/TD]
[TD]234[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Invalid[/TD]
[TD]345[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Valid[/TD]
[TD]345[/TD]
[/TR]
</tbody>[/TABLE]

I am looking for a formula (or possibly a macro) to place in the first column where it checks the ID column. If there is more than one row for the same ID, it looks at the status for all of them, and if just one of the values state "Valid", it updates the status to valid and deletes the rows for the other duplicates.
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
I added another column to attempt to get this working, but I believe I am missing something

[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Column A (what I want)[/TD]
[TD]Count[/TD]
[TD]Status[/TD]
[TD]ID[/TD]
[/TR]
[TR]
[TD]Good[/TD]
[TD]1[/TD]
[TD]Valid[/TD]
[TD]123[/TD]
[/TR]
[TR]
[TD]INVALID[/TD]
[TD]1[/TD]
[TD]Invalid[/TD]
[TD]234[/TD]
[/TR]
[TR]
[TD]VALID[/TD]
[TD]3[/TD]
[TD]Invalid[/TD]
[TD]345[/TD]
[/TR]
[TR]
[TD]VALID[/TD]
[TD]3[/TD]
[TD]Valid[/TD]
[TD]345[/TD]
[/TR]
[TR]
[TD]VALID[/TD]
[TD]3[/TD]
[TD]Valid[/TD]
[TD]345[/TD]
[/TR]
[TR]
[TD]INVALID[/TD]
[TD]3[/TD]
[TD]Invalid[/TD]
[TD]456[/TD]
[/TR]
[TR]
[TD]INVALID[/TD]
[TD]3[/TD]
[TD]Invalid[/TD]
[TD]456[/TD]
[/TR]
[TR]
[TD]INVALID[/TD]
[TD]3[/TD]
[TD]Invalid[/TD]
[TD]456[/TD]
[/TR]
</tbody>[/TABLE]

For Check column, I utilized the formula
=COUNTIF($C:$C,Table1[@[ID]])

For ColumnA, I used an index formula
{=IF(AND(B1=1,C1="VALID"), "Good", IF(SUMPRODUCT(IFERROR(D1:D$3000=D1)*(OR(C1:C$3000="VALID",$C1:$C$1="VALID")),FALSE)),"VALID","INVALID"))}

Am I going the correct path for this formula? Any tips would be greatly appreciated.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,824
Messages
6,181,187
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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