Organizing unique list ID's based off of flagged (Valid/Invalid) items

MurdochQuill

Board Regular
Joined
Nov 21, 2020
Messages
84
Office Version
  1. 365
Platform
  1. Windows
Hi all,

I have another question for today, I've been working through some list-based issues which seem simple but I just cant put it together in a workable format.

What I'm trying to do, is match unique ID's found in column "A" with some values. Based off of some simple rules, I am wanting to flag each rule with "Valid" or "Invalid". I've been fine up until this point, where I'm now trying to flag the unique ID as "No Valid flags" when all entries for the ID on the A column are marked as "Invalid" on any rule definition column.

So it should flag all unique ID's as "No valid flags" where no valid value for it exists. Basically I want to get rid of all the "Invalid" values where a "Valid" value exists for the same unique ID.

I have attached the spreadsheet example to this post :-)

Any help is appreciated.
Flags.xlsx
ABCDEFGHIJKLM
1IDFirst Final DifferenceInit >9Final <1Difference <2Flags?No Valids per unique ID?Contains VALID or No Valid flags
2Pond398.610.39VALIDVALIDINVALIDINVALIDNo Valid flagsYES
3Pond398.60.4VALIDVALIDINVALIDINVALIDNo Valid flagsYES
4Pond3108.61.4INVALIDVALIDINVALIDINVALIDNo Valid flagsYES
5Pond3108.61.4INVALIDVALIDINVALIDINVALIDNo Valid flagsYES
6Pond21082INVALIDVALIDVALIDINVALID
7Pond11156INVALIDVALIDVALIDINVALIDNo Valid flagsYES
8Pond2972VALIDVALIDVALIDVALIDYES
9Pond2972VALIDVALIDVALIDVALIDYES
10Pond3108.61.4INVALIDVALIDINVALIDINVALIDNo Valid flagsYES
11Pond41019INVALIDVALIDVALIDINVALIDNo Valid flagsYES
12Pond41019INVALIDVALIDVALIDINVALIDNo Valid flagsYES
13Pond51028INVALIDVALIDVALIDINVALID
14Pond51028INVALIDVALIDVALIDINVALID
15Pond51028INVALIDVALIDVALIDINVALID
16Pond5927VALIDVALIDVALIDVALIDYES
17Pond6972VALIDVALIDVALIDVALIDYES
18Pond71073INVALIDVALIDVALIDINVALIDNo Valid flagsYES
19Pond8972VALIDVALIDVALIDVALID
20Pond91073INVALIDVALIDVALIDINVALIDNo Valid flagsYES
21Pond101073INVALIDVALIDVALIDINVALIDNo Valid flagsYES
Sheet1
Cell Formulas
RangeFormula
D2:D21D2=B2-C2
Cells with Conditional Formatting
CellConditionCell FormatStop If True
F2:I22Cell Valuebeginning with "INVALID"textNO
F2:I22Cell Valuebeginning with "VALID"textNO
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Is it just one of the columns in your shown mini-sheet that you are wanting help with?
If so, which column?
If not, which columns?
 
Upvote 0
Is it just one of the columns in your shown mini-sheet that you are wanting help with?
If so, which column?
If not, which columns?
K column. I don't know how to go about getting to the result of No valid flags for Unique ID "X"
 
Last edited:
Upvote 0
K column.
Like this then?

21 05 16.xlsm
ABCDEFGHIJK
1IDFirst Final DifferenceInit >9Final <1Difference <2Flags?No Valids per unique ID?
2Pond398.610.39VALIDVALIDINVALIDINVALIDNo Valid flags
3Pond398.60.4VALIDVALIDINVALIDINVALIDNo Valid flags
4Pond3108.61.4INVALIDVALIDINVALIDINVALIDNo Valid flags
5Pond3108.61.4INVALIDVALIDINVALIDINVALIDNo Valid flags
6Pond21082INVALIDVALIDVALIDINVALID 
7Pond11156INVALIDVALIDVALIDINVALIDNo Valid flags
8Pond2972VALIDVALIDVALIDVALID 
9Pond2972VALIDVALIDVALIDVALID 
10Pond3108.61.4INVALIDVALIDINVALIDINVALIDNo Valid flags
11Pond41019INVALIDVALIDVALIDINVALIDNo Valid flags
12Pond41019INVALIDVALIDVALIDINVALIDNo Valid flags
13Pond51028INVALIDVALIDVALIDINVALID 
14Pond51028INVALIDVALIDVALIDINVALID 
15Pond51028INVALIDVALIDVALIDINVALID 
16Pond5927VALIDVALIDVALIDVALID 
17Pond6972VALIDVALIDVALIDVALID 
18Pond71073INVALIDVALIDVALIDINVALIDNo Valid flags
19Pond8972VALIDVALIDVALIDVALID 
20Pond91073INVALIDVALIDVALIDINVALIDNo Valid flags
21Pond101073INVALIDVALIDVALIDINVALIDNo Valid flags
Valid Flags
Cell Formulas
RangeFormula
D2:D21D2=B2-C2
K2:K21K2=IF(COUNTIFS(A$2:A$21,A2,I$2:I$21,"INVALID")=COUNTIF(A$2:A$21,A2),"No Valid flags","")



Edit: Or, although this is slightly longer, it should reduce any calculation overhead a little.

Excel Formula:
=IF(A2=A1,K1,IF(COUNTIFS(A$2:A$21,A2,I$2:I$21,"INVALID")=COUNTIF(A$2:A$21,A2),"No Valid flags",""))
 
Upvote 0
Like this then?

21 05 16.xlsm
ABCDEFGHIJK
1IDFirst Final DifferenceInit >9Final <1Difference <2Flags?No Valids per unique ID?
2Pond398.610.39VALIDVALIDINVALIDINVALIDNo Valid flags
3Pond398.60.4VALIDVALIDINVALIDINVALIDNo Valid flags
4Pond3108.61.4INVALIDVALIDINVALIDINVALIDNo Valid flags
5Pond3108.61.4INVALIDVALIDINVALIDINVALIDNo Valid flags
6Pond21082INVALIDVALIDVALIDINVALID 
7Pond11156INVALIDVALIDVALIDINVALIDNo Valid flags
8Pond2972VALIDVALIDVALIDVALID 
9Pond2972VALIDVALIDVALIDVALID 
10Pond3108.61.4INVALIDVALIDINVALIDINVALIDNo Valid flags
11Pond41019INVALIDVALIDVALIDINVALIDNo Valid flags
12Pond41019INVALIDVALIDVALIDINVALIDNo Valid flags
13Pond51028INVALIDVALIDVALIDINVALID 
14Pond51028INVALIDVALIDVALIDINVALID 
15Pond51028INVALIDVALIDVALIDINVALID 
16Pond5927VALIDVALIDVALIDVALID 
17Pond6972VALIDVALIDVALIDVALID 
18Pond71073INVALIDVALIDVALIDINVALIDNo Valid flags
19Pond8972VALIDVALIDVALIDVALID 
20Pond91073INVALIDVALIDVALIDINVALIDNo Valid flags
21Pond101073INVALIDVALIDVALIDINVALIDNo Valid flags
Valid Flags
Cell Formulas
RangeFormula
D2:D21D2=B2-C2
K2:K21K2=IF(COUNTIFS(A$2:A$21,A2,I$2:I$21,"INVALID")=COUNTIF(A$2:A$21,A2),"No Valid flags","")



Edit: Or, although this is slightly longer, it should reduce any calculation overhead a little.

Excel Formula:
=IF(A2=A1,K1,IF(COUNTIFS(A$2:A$21,A2,I$2:I$21,"INVALID")=COUNTIF(A$2:A$21,A2),"No Valid flags",""))
Perfect!

Also, out of curiosity how does the code edited in at the bottom reduce overhead?
 
Upvote 0
Good news!

Also, out of curiosity how does the code edited in at the bottom reduce overhead?
In the original formula, those COUNTIFS and COUNTIF functions have to be calculated for every row.
In the last formula, if the value in column A is the same as the value in column A in the row above, the col K value is just copied from the row above so no COUNTIFS or COUNTIF is required for that row.
For your sample data, the blue rows below are simply copied from above and only the yellow rows require the more complex calculation.

21 05 16.xlsm
AK
1IDNo Valids per unique ID?
2Pond3No Valid flags
3Pond3No Valid flags
4Pond3No Valid flags
5Pond3No Valid flags
6Pond2 
7Pond1No Valid flags
8Pond2 
9Pond2 
10Pond3No Valid flags
11Pond4No Valid flags
12Pond4No Valid flags
13Pond5 
14Pond5 
15Pond5 
16Pond5 
17Pond6 
18Pond7No Valid flags
19Pond8 
20Pond9No Valid flags
21Pond10No Valid flags
Valid Flags
Cell Formulas
RangeFormula
K2:K21K2=IF(A2=A1,K1,IF(COUNTIFS(A$2:A$21,A2,I$2:I$21,"INVALID")=COUNTIF(A$2:A$21,A2),"No Valid flags",""))
 
Upvote 0
Solution

Forum statistics

Threads
1,224,823
Messages
6,181,175
Members
453,021
Latest member
Justyna P

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