Returning results with a unique condition

%3CLINGO-SUB%20id%3D%22lingo-sub-1467970%22%20slang%3D%22en-US%22%3ERe%3A%20Returning%20results%20with%20a%20unique%20condition%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1467970%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F494154%22%20target%3D%22_blank%22%3E%40shade206%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20think%20they%20all%20have%20ANI%20apart%20from%20Debbie%20and%20Fransico%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Ewas%20this%20just%20a%20typo%3F%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1467985%22%20slang%3D%22en-US%22%3ERe%3A%20Returning%20results%20with%20a%20unique%20condition%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1467985%22%20slang%3D%22en-US%22%3E%3CP%3EThat%20is%20CORRECT.%20However%2C%20i%20want%20ONLY%20the%20USER%20IDs%20that%20ONLY%20have%20ONE%20ANI%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F667968%22%20target%3D%22_blank%22%3E%40peteryac60%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1467946%22%20slang%3D%22en-US%22%3EReturning%20results%20with%20a%20unique%20condition%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1467946%22%20slang%3D%22en-US%22%3E%3CP%3EHello%20all%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EOn%20a%20second%20sheet%20I'm%20looking%20to%20extract%20only%20the%20rows%20where%20a%20USER%20ID%20has%20ONLY%20ONE%20%22ANI%22%20status%2C%20in%20this%20case%20the%20only%20rows%20that%20meet%20that%20criteria%20are%20for%20%22Raj%20Singh%22%20and%20%22Mr%20Goerge%22%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CTABLE%20width%3D%22223%22%3E%3CTBODY%3E%3CTR%3E%3CTD%20width%3D%2254%22%3EUSER%20ID%3C%2FTD%3E%3CTD%20width%3D%22116%22%3ENAME%3C%2FTD%3E%3CTD%20width%3D%2253%22%3ESTATUS%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E11%3C%2FTD%3E%3CTD%3EJane%20Smith%3C%2FTD%3E%3CTD%3EANI%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E11%3C%2FTD%3E%3CTD%3EJohn%20Smith%3C%2FTD%3E%3CTD%3EANI%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E15%3C%2FTD%3E%3CTD%3ERaj%20Singh%3C%2FTD%3E%3CTD%3EANI%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E17%3C%2FTD%3E%3CTD%3EDebbie%20Downer%3C%2FTD%3E%3CTD%3ENIN%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E17%3C%2FTD%3E%3CTD%3EDonald%20Downer%3C%2FTD%3E%3CTD%3EANI%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E21%3C%2FTD%3E%3CTD%3ELee%20Nguyen%3C%2FTD%3E%3CTD%3EANI%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E21%3C%2FTD%3E%3CTD%3EChun%20Lee%20Nguyen%3C%2FTD%3E%3CTD%3EANI%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E22%3C%2FTD%3E%3CTD%3EFransisco%20Galvez%3C%2FTD%3E%3CTD%3ENIN%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E22%3C%2FTD%3E%3CTD%3EFranchesca%20Galvez%3C%2FTD%3E%3CTD%3EANI%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E25%3C%2FTD%3E%3CTD%3EMr%20George%3C%2FTD%3E%3CTD%3EANI%3C%2FTD%3E%3C%2FTR%3E%3C%2FTBODY%3E%3C%2FTABLE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20attached%20the%20sample%20workbook%2C%20a%20little%20help%20please%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1467946%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EBI%20%26amp%3B%20Data%20Analysis%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1468415%22%20slang%3D%22en-US%22%3ERe%3A%20Returning%20results%20with%20a%20unique%20condition%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1468415%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F494154%22%20target%3D%22_blank%22%3E%40shade206%3C%2FA%3E%26nbsp%3BYour%20criteria%20may%20have%20been%20conveyed%20incorrectly%2C%20as%20in%20the%20case%20below%2C%20the%20rows%20that%20meets%20the%20criteria.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECriteria%201.%3C%2FP%3E%3CP%3E%3CSPAN%3E-%20the%20rows%20where%20a%20USER%20ID%20has%20ONLY%20ONE%20%22ANI%22%20status%20is%20as%20shown%20below%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3EUSER%20ID%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3BNAME%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3BSTATUS%3C%2FP%3E%3CTABLE%20width%3D%22259%22%3E%3CTBODY%3E%3CTR%3E%3CTD%3E15%3C%2FTD%3E%3CTD%3ERaj%20Singh%3C%2FTD%3E%3CTD%3EANI%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E17%3C%2FTD%3E%3CTD%3EDonald%20Downer%3C%2FTD%3E%3CTD%3EANI%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E22%3C%2FTD%3E%3CTD%3EFranchesca%20Galvez%3C%2FTD%3E%3CTD%3EANI%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E25%3C%2FTD%3E%3CTD%3EMr%20George%3C%2FTD%3E%3CTD%3EANI%3C%2FTD%3E%3C%2FTR%3E%3C%2FTBODY%3E%3C%2FTABLE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EMaybe%20the%20criteria%20you%20meant%20is%20as%20below%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECriteria%202.%3C%2FP%3E%3CP%3E-%20User%20ID%20that%20appears%20once%20AND%20that%20has%20ONLY%20ONE%20%22ANI%22%20status.%3C%2FP%3E%3CP%3Eif%20this%20is%20the%20criteria%20then%20you%20will%20only%20return%20the%20rows%20as%20shown%20below%3C%2FP%3E%3CP%3EUSER%20ID%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3BNAME%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3BSTATUS%3C%2FP%3E%3CTABLE%20width%3D%22213%22%3E%3CTBODY%3E%3CTR%3E%3CTD%3E15%3C%2FTD%3E%3CTD%3ERaj%20Singh%3C%2FTD%3E%3CTD%3EANI%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E25%3C%2FTD%3E%3CTD%3EMr%20George%3C%2FTD%3E%3CTD%3EANI%3C%2FTD%3E%3C%2FTR%3E%3C%2FTBODY%3E%3C%2FTABLE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESee%20the%20attached%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20added%202%20new%20sheet(%3CSTRONG%3ECriteria%201%3C%2FSTRONG%3E%20and%20%3CSTRONG%3ECriteria%202%3C%2FSTRONG%3E)%20that%20gives%20you%20both%20results.%20I%20designed%20it%20using%20Power%20Query%20advance%20Group%20By%20function%2C%20for%20every%20change%20you%20make%20to%20%3CSTRONG%3ESheet1%3C%2FSTRONG%3E%20you%20need%20to%20%3CSTRONG%3Eclick%20Refresh%3C%2FSTRONG%3E%20to%20have%20it%20reflected%20to%20%3CSTRONG%3ECriteria%201%3C%2FSTRONG%3E%20and%20%3CSTRONG%3ECriteria%202%3C%2FSTRONG%3E%20sheets.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1468523%22%20slang%3D%22en-US%22%3ERe%3A%20Returning%20results%20with%20a%20unique%20condition%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1468523%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F687672%22%20target%3D%22_blank%22%3E%40ElElyon%3C%2FA%3E%26nbsp%3Bwhile%20i%20really%20appreciate%20you%20taking%20the%20time%20to%20do%20this%2C%20i%20don't%20know%20exactly%20what%20you%20did%20to%20achieve%20this%2C%20i%20just%20have%20the%20results%20i%20desired.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI'd%20need%20to%20know%20what%20you%20did%20in%20order%20to%20recreate%20it%20myself%20against%20my%20actual%20data.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1468579%22%20slang%3D%22en-US%22%3ERe%3A%20Returning%20results%20with%20a%20unique%20condition%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1468579%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F494154%22%20target%3D%22_blank%22%3E%40shade206%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHere%20is%20an%20alternative%20solution%20-%20add%20an%20extra%20column%20and%20count%20the%20duplicates%20%2C%20any%20item%20with%201%20is%20unique%20so%20you%20can%20then%20extract%20as%20required.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Ehope%20that%20helps.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPeter%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1468635%22%20slang%3D%22en-US%22%3ERe%3A%20Returning%20results%20with%20a%20unique%20condition%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1468635%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F494154%22%20target%3D%22_blank%22%3E%40shade206%3C%2FA%3E%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20am%20glad%20it%20solved%20your%20problem.%20I%20will%20share%20the%20code%20below%2C%20if%20it%20still%20does%20not%20make%20sense.%3C%2FP%3E%3CP%3ELet%20me%20know%2C%20which%20of%20the%20criteria%20you%20wanted.%20And%20I%20could%20look%20into%20doing%20a%20quick%20video%20for%20you.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Efor%20Criteria%201%20see%20the%20m%20code%20below.%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-powerquery%22%3E%3CCODE%3Elet%0ASource%20%3D%20Excel.CurrentWorkbook()%7B%5BName%3D%22Table1%22%5D%7D%5BContent%5D%2C%0A%23%22Changed%20Type%22%20%3D%20Table.TransformColumnTypes(Source%2C%7B%7B%22USER%20ID%22%2C%20Int64.Type%7D%2C%20%7B%22NAME%22%2C%20type%20text%7D%2C%20%7B%22STATUS%22%2C%20type%20text%7D%7D)%2C%0A%23%22Filtered%20Rows%22%20%3D%20Table.SelectRows(%23%22Changed%20Type%22%2C%20each%20(%5BSTATUS%5D%20%3D%20%22ANI%22))%2C%0A%23%22Grouped%20Rows%22%20%3D%20Table.Group(%23%22Filtered%20Rows%22%2C%20%7B%22USER%20ID%22%7D%2C%20%7B%7B%22Count%22%2C%20each%20Table.RowCount(_)%2C%20type%20number%7D%2C%20%7B%22New%22%2C%20each%20_%2C%20type%20table%20%5BUSER%20ID%3Dnumber%2C%20NAME%3Dtext%2C%20STATUS%3Dtext%5D%7D%7D)%2C%0A%23%22Filtered%20Rows1%22%20%3D%20Table.SelectRows(%23%22Grouped%20Rows%22%2C%20each%20(%5BCount%5D%20%3D%201))%2C%0A%23%22Removed%20Other%20Columns%22%20%3D%20Table.SelectColumns(%23%22Filtered%20Rows1%22%2C%7B%22New%22%7D)%2C%0A%23%22Expanded%20New%22%20%3D%20Table.ExpandTableColumn(%23%22Removed%20Other%20Columns%22%2C%20%22New%22%2C%20%7B%22USER%20ID%22%2C%20%22NAME%22%2C%20%22STATUS%22%7D%2C%20%7B%22USER%20ID%22%2C%20%22NAME%22%2C%20%22STATUS%22%7D)%0Ain%0A%23%22Expanded%20New%22%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EFor%20the%20Criteria%202%20see%20the%20m%20code%20below.%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-powerquery%22%3E%3CCODE%3Elet%0A%20%20%20%20Source%20%3D%20Excel.CurrentWorkbook()%7B%5BName%3D%22Table1%22%5D%7D%5BContent%5D%2C%0A%20%20%20%20%23%22Changed%20Type%22%20%3D%20Table.TransformColumnTypes(Source%2C%7B%7B%22USER%20ID%22%2C%20Int64.Type%7D%2C%20%7B%22NAME%22%2C%20type%20text%7D%2C%20%7B%22STATUS%22%2C%20type%20text%7D%7D)%2C%0A%20%20%20%20%23%22Grouped%20Rows%22%20%3D%20Table.Group(%23%22Changed%20Type%22%2C%20%7B%22USER%20ID%22%7D%2C%20%7B%7B%22Count%22%2C%20each%20Table.RowCount(_)%2C%20type%20number%7D%2C%20%7B%22New%22%2C%20each%20_%2C%20type%20table%20%5BUSER%20ID%3Dnumber%2C%20NAME%3Dtext%2C%20STATUS%3Dtext%5D%7D%7D)%2C%0A%20%20%20%20%23%22Filtered%20Rows1%22%20%3D%20Table.SelectRows(%23%22Grouped%20Rows%22%2C%20each%20(%5BCount%5D%20%3D%201))%2C%0A%20%20%20%20%23%22Removed%20Other%20Columns%22%20%3D%20Table.SelectColumns(%23%22Filtered%20Rows1%22%2C%7B%22New%22%7D)%2C%0A%20%20%20%20%23%22Expanded%20New%22%20%3D%20Table.ExpandTableColumn(%23%22Removed%20Other%20Columns%22%2C%20%22New%22%2C%20%7B%22USER%20ID%22%2C%20%22NAME%22%2C%20%22STATUS%22%7D%2C%20%7B%22USER%20ID%22%2C%20%22NAME%22%2C%20%22STATUS%22%7D)%0Ain%0A%20%20%20%20%23%22Expanded%20New%22%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECheers!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1468936%22%20slang%3D%22en-US%22%3ERe%3A%20Returning%20results%20with%20a%20unique%20condition%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1468936%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F687672%22%20target%3D%22_blank%22%3E%40ElElyon%3C%2FA%3E%26nbsp%3BWow%2C%20this%20is%20super%20advanced%20stuff%20for%20me%2C%20is%20there%20no%20way%20to%20do%20it%20via%20Formula%20just%20through%20a%20spreadsheet%3F%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1468960%22%20slang%3D%22en-US%22%3ERe%3A%20Returning%20results%20with%20a%20unique%20condition%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1468960%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F687672%22%20target%3D%22_blank%22%3E%40ElElyon%3C%2FA%3E%26nbsp%3BThank%20you%20for%20taking%20the%20time%2C%20i'm%20not%20familiar%20with%20Power%20Queries%20or%20any%20of%20this%2C%20is%20there%20are%20way%20to%20do%20it%20just%20via%20Formula%20in%20a%20cell%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1469047%22%20slang%3D%22en-US%22%3ERe%3A%20Returning%20results%20with%20a%20unique%20condition%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1469047%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F494154%22%20target%3D%22_blank%22%3E%40shade206%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWith%20formula%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22image.png%22%20style%3D%22width%3A%20577px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F199097i263D2C9E36B43B13%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22image.png%22%20alt%3D%22image.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3Eyou%20may%20use%20in%20E2%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-excel%22%3E%3CCODE%3E%3DIFERROR(INDEX(A%242%3AA%2411%2CAGGREGATE(15%2C6%2C1%2F(COUNTIFS(%24A%242%3A%24A%2411%2C%24A%242%3A%24A%2411)%3D1)*(ROW(%24A%242%3A%24A%2411)-ROW(%24A%241))%2CROW()-ROW(%24E%241)))%2C%22%22)%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3Edrag%20it%20to%20the%20right%20and%20all%20down%20till%20empty%20cells%20appear.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1469244%22%20slang%3D%22en-US%22%3ERe%3A%20Returning%20results%20with%20a%20unique%20condition%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1469244%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F494154%22%20target%3D%22_blank%22%3E%40shade206%3C%2FA%3E%26nbsp%3B%20Another%20simple%20way%20to%20achieve%20this%20using%20excel%20and%20without%20going%20the%20Power%20Query%20path%2C%20will%20be%20to%20use%20the%26nbsp%3B%20%3CSTRONG%3E%22Filter%22%3C%2FSTRONG%3E%20function%20in%20excel%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EYou%20should%20first%20go%20to%20YouTube%20and%20watch%20a%20quick%20video%20on%20how%20to%20use%20the%20%3CSTRONG%3EFilter%3C%2FSTRONG%3E%20function%2C%20so%20what%20I%20am%20showing%20you%20below%20make%20more%20sense.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20added%20a%20sheet%20called%20%22Result%22%20to%20the%20attached%20excel%20file.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Ethe%20sheet%20uses%20the%20following%20formula%20in%20any%20cell.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-excel%22%3E%3CCODE%3E%3DFILTER(Table1%2C(Table1%5BSTATUS%5D%3D%22ANI%22)*(COUNTIFS(Table1%5BUSER%20ID%5D%2CTable1%5BUSER%20ID%5D)%3D1)%2C%22Not%20Found%22)%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EFormula%20Usage%3C%2FP%3E%3CP%3E%3DFilter(array%20or%20table%26nbsp%3B%3CSTRONG%3E%2C%20%3CFONT%20color%3D%22%23FF6600%22%3ECondition%3C%2FFONT%3E%20%2C%3C%2FSTRONG%3E%20Alternate%20result)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20specified%202%20conditions%20in%20the%20excel%20function%20above.%3C%2FP%3E%3CP%3ECondition%201%20%3D%20If%20STATUS%20is%20ANI%3C%2FP%3E%3CP%3ECondition%202%20%3D%20if%20USER%20ID%20appear%20ONCE(1)%3C%2FP%3E%3CP%3EI%20used%20%3CFONT%20color%3D%22%23FF6600%22%3E%3CSTRONG%3E*%20%3C%2FSTRONG%3E%3CFONT%20color%3D%22%23000000%22%3Esymbol%20for%3C%2FFONT%3E%3CSTRONG%3E%20AND%26nbsp%3B%3C%2FSTRONG%3E%3CFONT%20color%3D%22%23000000%22%3Eto%20apply%20both%20conditions.%20I%20would%20have%20use%20%2B%20for%20OR.%3C%2FFONT%3E%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CFONT%20color%3D%22%23FF6600%22%3E%3CFONT%20color%3D%22%23000000%22%3EYou%20can%20play%20with%20the%20formula%20by%20removing%20one%20condition%2C%20and%20you%20can%20also%20try%20changing%20the%201%20to%202%2C%20or%20even%203%20to%20see%20the%20behavior.%3C%2FFONT%3E%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CFONT%20color%3D%22%23FF6600%22%3E%3CFONT%20color%3D%22%23000000%22%3EDoes%20this%20work%20better%20for%20you%20%3F%3C%2FFONT%3E%3C%2FFONT%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Contributor

Hello all,

 

On a second sheet I'm looking to extract only the rows where a USER ID has ONLY ONE "ANI" status, in this case the only rows that meet that criteria are for "Raj Singh" and "Mr Goerge"

 

USER IDNAMESTATUS
11Jane SmithANI
11John SmithANI
15Raj SinghANI
17Debbie DownerNIN
17Donald DownerANI
21Lee NguyenANI
21Chun Lee NguyenANI
22Fransisco GalvezNIN
22Franchesca GalvezANI
25Mr GeorgeANI

 

I have attached the sample workbook, a little help please?

9 Replies
Highlighted

@shade206

 

I think they all have ANI apart from Debbie and Fransico?

 

was this just a typo? 

Highlighted

That is CORRECT. However, i want ONLY the USER IDs that ONLY have ONE ANI @peteryac60 

Highlighted

@shade206 Your criteria may have been conveyed incorrectly, as in the case below, the rows that meets the criteria.

 

Criteria 1.

- the rows where a USER ID has ONLY ONE "ANI" status is as shown below;

USER ID           NAME           STATUS

15Raj SinghANI
17Donald DownerANI
22Franchesca GalvezANI
25Mr GeorgeANI

 

Maybe the criteria you meant is as below

 

Criteria 2.

- User ID that appears once AND that has ONLY ONE "ANI" status.

if this is the criteria then you will only return the rows as shown below

USER ID     NAME       STATUS

15Raj SinghANI
25Mr GeorgeANI

 

See the attached

 

I have added 2 new sheet(Criteria 1 and Criteria 2) that gives you both results. I designed it using Power Query advance Group By function, for every change you make to Sheet1 you need to click Refresh to have it reflected to Criteria 1 and Criteria 2 sheets.

 

 

Highlighted

@ElElyon while i really appreciate you taking the time to do this, i don't know exactly what you did to achieve this, i just have the results i desired. 

 

I'd need to know what you did in order to recreate it myself against my actual data. 

Highlighted

@shade206 

 

Here is an alternative solution - add an extra column and count the duplicates , any item with 1 is unique so you can then extract as required.

 

hope that helps.

 

Peter

 

 

 

Highlighted

@shade206  

 

I am glad it solved your problem. I will share the code below, if it still does not make sense.

Let me know, which of the criteria you wanted. And I could look into doing a quick video for you.

 

for Criteria 1 see the m code below.

let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"USER ID", Int64.Type}, {"NAME", type text}, {"STATUS", type text}}),
#"Filtered Rows" = Table.SelectRows(#"Changed Type", each ([STATUS] = "ANI")),
#"Grouped Rows" = Table.Group(#"Filtered Rows", {"USER ID"}, {{"Count", each Table.RowCount(_), type number}, {"New", each _, type table [USER ID=number, NAME=text, STATUS=text]}}),
#"Filtered Rows1" = Table.SelectRows(#"Grouped Rows", each ([Count] = 1)),
#"Removed Other Columns" = Table.SelectColumns(#"Filtered Rows1",{"New"}),
#"Expanded New" = Table.ExpandTableColumn(#"Removed Other Columns", "New", {"USER ID", "NAME", "STATUS"}, {"USER ID", "NAME", "STATUS"})
in
#"Expanded New"

 

For the Criteria 2 see the m code below.

let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"USER ID", Int64.Type}, {"NAME", type text}, {"STATUS", type text}}),
    #"Grouped Rows" = Table.Group(#"Changed Type", {"USER ID"}, {{"Count", each Table.RowCount(_), type number}, {"New", each _, type table [USER ID=number, NAME=text, STATUS=text]}}),
    #"Filtered Rows1" = Table.SelectRows(#"Grouped Rows", each ([Count] = 1)),
    #"Removed Other Columns" = Table.SelectColumns(#"Filtered Rows1",{"New"}),
    #"Expanded New" = Table.ExpandTableColumn(#"Removed Other Columns", "New", {"USER ID", "NAME", "STATUS"}, {"USER ID", "NAME", "STATUS"})
in
    #"Expanded New"

 

Cheers!

Highlighted

@ElElyon Thank you for taking the time, i'm not familiar with Power Queries or any of this, is there are way to do it just via Formula in a cell?

Highlighted

@shade206 

With formula

image.png

you may use in E2

=IFERROR(INDEX(A$2:A$11,AGGREGATE(15,6,1/(COUNTIFS($A$2:$A$11,$A$2:$A$11)=1)*(ROW($A$2:$A$11)-ROW($A$1)),ROW()-ROW($E$1))),"")

drag it to the right and all down till empty cells appear.

Highlighted

@shade206  Another simple way to achieve this using excel and without going the Power Query path, will be to use the  "Filter" function in excel 

 

You should first go to YouTube and watch a quick video on how to use the Filter function, so what I am showing you below make more sense.

 

I have added a sheet called "Result" to the attached excel file.

 

the sheet uses the following formula in any cell.

 

=FILTER(Table1,(Table1[STATUS]="ANI")*(COUNTIFS(Table1[USER ID],Table1[USER ID])=1),"Not Found")

 

Formula Usage

=Filter(array or table , Condition , Alternate result)

 

I specified 2 conditions in the excel function above.

Condition 1 = If STATUS is ANI

Condition 2 = if USER ID appear ONCE(1)

I used * symbol for AND to apply both conditions. I would have use + for OR.

 

You can play with the formula by removing one condition, and you can also try changing the 1 to 2, or even 3 to see the behavior.

 

Does this work better for you ?