SOLVED
Home

Counting unique entries and creating a list

%3CLINGO-SUB%20id%3D%22lingo-sub-846634%22%20slang%3D%22en-US%22%3ECounting%20unique%20entries%20and%20creating%20a%20list%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-846634%22%20slang%3D%22en-US%22%3E%3CP%3EIs%20there%20a%20straight%20forward%20way%20to%20get%20Excel%20to%20count%20the%20number%20of%20unique%20items%20in%20a%20list%20and%20then%20total%20how%20many%20of%20each%20item%20there%20are%3F%20For%20example%20in%20the%20list%3A%204%2C5%2C6%2C7%2C4%2C4%2C5%2C7%20I%20would%20like%20Excel%20to%20tell%20me%20that%20there%20are%20three%204's%2C%20two%205's%2C%20one%206%2C%20and%20two%207's.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI'm%20hoping%20to%20use%20this%20to%20create%20a%20relatively%20simple%20inventory%20counter%20without%20having%20to%20manually%20count%20each%20item.%20I%20am%20quite%20competant%20with%20Excel%20and%20am%20in%20the%20process%20of%20learning%20how%20to%20use%20Macros%20and%20VBA%20if%20they%20can%20be%20of%20any%20use.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-846634%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EMacros%20and%20VBA%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-846700%22%20slang%3D%22en-US%22%3ERe%3A%20Counting%20unique%20entries%20and%20creating%20a%20list%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-846700%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F406570%22%20target%3D%22_blank%22%3E%40milanolm%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThere%20are%20several%20ways%20to%20achieve%20that.%3C%2FP%3E%3CP%3EOne%20easy%20way%20is%2C%20you%20can%20insert%20a%20Pivot%20Table%20and%20drag%20the%20same%20field%20you%20are%20trying%20to%20count%20the%20unique%20occurrences%20in%20both%20the%20Rows%20area%20and%20the%20Values%20area%20and%20change%20the%20value%20field%20setting%20to%20Count%20if%20the%20column%20you%20are%20working%20contains%20the%20numeric%20data.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-847196%22%20slang%3D%22en-US%22%3ERe%3A%20Counting%20unique%20entries%20and%20creating%20a%20list%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-847196%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F406570%22%20target%3D%22_blank%22%3E%40milanolm%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EYes%2C%20Pivot%20Table%20is%20the%20easiest%20in%20pre-DA%20Excel.%20When%20Dynamic%20Arrays%20appear%20that%20could%20be%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20327px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F130988i8F13F5EF9E31AFAE%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22image.png%22%20title%3D%22image.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3E%3DUNIQUE(A2%3AA9)%0A%0Aand%0A%0A%3DCOUNTIF(A2%3AA9%2CUNIQUE(A2%3AA9))%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-847893%22%20slang%3D%22en-US%22%3ERe%3A%20Counting%20unique%20entries%20and%20creating%20a%20list%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-847893%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F521%22%20target%3D%22_blank%22%3E%40Sergei%20Baklan%3C%2FA%3E%26nbsp%3BI%20just%20ran%20across%20the%20UNIQUE%20function%20and%20it%20does%20exactly%20what%20I%20need%2C%20but%20it%20seems%20to%20only%20return%20the%20first%20value%20in%20my%20list.%20For%20example%20your%20%22%3DUNIQUE(A2%3AA9)%22%20is%20returning%20only%20%224%22%20in%20the%20target%20cell.%20Ideally%2C%20I%20wanted%20to%20do%20something%20like%20%22%3DUNIQUE(A2%3AC9)%22%2C%20but%20that%20is%20doing%20exactly%20the%20same%20and%20returning%20only%20the%20value%20of%20A2%20in%20the%20formula%20cell.%20No%20dynamic%20array%20as%20expected.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-848431%22%20slang%3D%22en-US%22%3ERe%3A%20Counting%20unique%20entries%20and%20creating%20a%20list%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-848431%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F406909%22%20target%3D%22_blank%22%3E%40Tasilee%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%3DUNIQUE(A2%3AA9)%20shall%20return%20the%20spill%20with%20all%20unique%20items%2C%20please%20check%20the%20file%20attached.%20If%20not%2C%20could%20you%20please%20provide%20the%20sample.%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-848446%22%20slang%3D%22en-US%22%3ERe%3A%20Counting%20unique%20entries%20and%20creating%20a%20list%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-848446%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F394231%22%20target%3D%22_blank%22%3E%40Subodh_Tiwari_sktneer%3C%2FA%3E%26nbsp%3B%20The%20pivot%20table%20worked%20exactly%20like%20I%20was%20hoping.%20Thanks!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-848530%22%20slang%3D%22en-US%22%3ERe%3A%20Counting%20unique%20entries%20and%20creating%20a%20list%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-848530%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F406570%22%20target%3D%22_blank%22%3E%40milanolm%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EYou're%20welcome!%20Glad%20you%20found%20it%20helpful.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-850023%22%20slang%3D%22en-US%22%3ERe%3A%20Counting%20unique%20entries%20and%20creating%20a%20list%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-850023%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F521%22%20target%3D%22_blank%22%3E%40Sergei%20Baklan%3C%2FA%3E.%26nbsp%3BStrange.%20The%20cell%20C2%20in%20your%20Excel%20worksheet%20that%20I%20downloaded%20with%20%22Save%20link%20as%20...%22%20is%20%22%3D_xlfn.UNIQUE(A2%3AA9)%22.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIf%20I%20double%20click%20the%20file%20on%20the%20community%20site%2C%20it%20opens%20in%20Google%20Docs%20and%20that%20same%20cell%20is%20rendered%20as%20%22%3CSPAN%20class%3D%22%20default-formula-text-color%22%3E%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22%20default-formula-text-color%22%3EARRAY_CONSTRAIN%3C%2FSPAN%3E%3CSPAN%20class%3D%22%20default-formula-text-color%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22%20default-formula-text-color%22%3EARRAYFORMULA%3C%2FSPAN%3E%3CSPAN%20class%3D%22%20default-formula-text-color%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22%20default-formula-text-color%22%3EUNIQUE%3C%2FSPAN%3E%3CSPAN%20class%3D%22%20default-formula-text-color%22%3E(%3C%2FSPAN%3E%3CSPAN%3EA2%3AA9%3C%2FSPAN%3E%3CSPAN%20class%3D%22%20default-formula-text-color%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22%20default-formula-text-color%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22%20default-formula-text-color%22%3E%2C%3C%2FSPAN%3E%3CSPAN%20class%3D%22number%22%3E4%3C%2FSPAN%3E%3CSPAN%20class%3D%22%20default-formula-text-color%22%3E%2C%3C%2FSPAN%3E%3CSPAN%20class%3D%22number%22%3E1%3C%2FSPAN%3E%3CSPAN%20class%3D%22%20default-formula-text-color%22%3E)%22.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22%20default-formula-text-color%22%3EI%20can't%20make%20sense%20of%20it%2C%20so%20I'll%20attach%20the%20spreadsheet%20with%20real%20data%20where%20I%20am%20trying%20to%20list%20unique%20rows.%20The%20failing%20formula%20%22%3DUNIQUE(M2%3AO510)%22%20is%20in%20cell%20U2.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%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-851042%22%20slang%3D%22en-US%22%3ERe%3A%20Counting%20unique%20entries%20and%20creating%20a%20list%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-851042%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F406909%22%20target%3D%22_blank%22%3E%40Tasilee%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3Exlfn%20means%20your%20version%20of%20Excel%20doesn't%20support%20dynamic%20arrays%2C%20in%20particular%20UNIQUE%20function.%20So%20far%20it's%20available%20for%20Office%20365%20subscribers%20on%20Insiders%20channels.%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fsupport.office.com%2Fen-us%2Farticle%2Fissue-an-xlfn-prefix-is-displayed-in-front-of-a-formula-882f1ef7-68fb-4fcd-8d54-9fbb77fd5025%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fsupport.office.com%2Fen-us%2Farticle%2Fissue-an-xlfn-prefix-is-displayed-in-front-of-a-formula-882f1ef7-68fb-4fcd-8d54-9fbb77fd5025%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-853691%22%20slang%3D%22en-US%22%3ERe%3A%20Counting%20unique%20entries%20and%20creating%20a%20list%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-853691%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F521%22%20target%3D%22_blank%22%3E%40Sergei%20Baklan%3C%2FA%3E%26nbsp%3B.%20I%20have%20Office%20365%2C%20but%20I%20re-installed%20it%20just%20to%20make%20sure.%20Excel%20also%20accepts%20the%20formula%20%22%3Dunique(A1%3AA9)%22%20so%20it%20knows%20about%2C%20but%20it%20just%20places%20what%20looks%20like%20the%20A1%20value%20into%20the%20formula%20cell%2C%20and%20no%20other%20cells%20are%20populated.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20no%20idea%20why%20this%20behaviour%20is%20occuring.%20If%20I%20search%20in%20Help%20for%20%22unique%22%20I%20get%20link%20to%20use%20Data%20%7C%26nbsp%3B%20Sort%2FFilter%20%7C%20Advanced%20%7C%20Copy%20to%20(%22B1%22)%20Unique%20records%20only.%20If%20I%20have%20in%20A1%3AA9%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Ea%3C%2FP%3E%3CP%3Ea%3C%2FP%3E%3CP%3Eb%3C%2FP%3E%3CP%3Ec%3C%2FP%3E%3CP%3Eb%3C%2FP%3E%3CP%3Ea%3C%2FP%3E%3CP%3Ed%3C%2FP%3E%3CP%3Ed%3C%2FP%3E%3CP%3Ed%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Eand%20I%20get%20in%20B1%3AB5%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Ea%3C%2FP%3E%3CP%3Ea%3C%2FP%3E%3CP%3Eb%3C%2FP%3E%3CP%3Ec%3C%2FP%3E%3CP%3Ed%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EEven%20this%20is%20not%20correct.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%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-854150%22%20slang%3D%22en-US%22%3ERe%3A%20Counting%20unique%20entries%20and%20creating%20a%20list%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-854150%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F406909%22%20target%3D%22_blank%22%3E%40Tasilee%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECheck%20all%20the%20'a'%20values%20in%20the%20range%20used%20in%20the%20formula.%20One%20of%20'a'%20must%20be%20having%20a%20leading%20or%20a%20trailing%20space%20in%20it%20and%20that's%20why%20it's%20picking%20two%20'a'%20values.%3C%2FP%3E%3CP%3EIn%20C1%2C%20place%20the%20formula%20%3DLEN(A1)%20and%20copy%20it%20down%20and%20check%20the%20length%20returned%20for%20all%20the%20'a'%20values%20and%20you%20will%20find%20that%20the%20length%20of%20all%20the%20'a'%20values%20is%20not%201.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EOr%20you%20should%20try%20this%20formula%20which%20should%20return%20the%20correct%20output%20ignoring%20any%20leading%20or%20trailing%20spaces.%3C%2FP%3E%3CP%3E%3CSTRONG%3E%3DUNIQUE(TRIM(A1%3AA9))%3C%2FSTRONG%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-855122%22%20slang%3D%22en-US%22%3ERe%3A%20Counting%20unique%20entries%20and%20creating%20a%20list%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-855122%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F406909%22%20target%3D%22_blank%22%3E%40Tasilee%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIf%20you%20have%20UNIQUE%20from%20Excel%20with%20Dynamic%20Arrays%2C%20Help%20shall%20show%20something%20like%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20457px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F131761i819D39854630A9EF%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22image.png%22%20title%3D%22image.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EWhat%20you%20speak%20about%20that's%20Advanced%20filter.%20It%20consider%20first%20cell%20in%20the%20list%20as%20column%20label.%20In%20your%20case%20that's%20A1.%20Thus%20first%20%22a%22%20is%20considered%20as%20list%20name%2C%20not%20as%20data.%20More%20correct%20will%20be%20like%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20389px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F131763i90B729A158C2CBA1%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22image.png%22%20title%3D%22image.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EAnd%20word%20exactly%20is%20your%20Excel%20channel%20and%20build%3F%20You%20may%20find%20info%20in%20File-%26gt%3BAccount%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20517px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F131765i9463FADC63FE3E58%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22image.png%22%20title%3D%22image.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-855290%22%20slang%3D%22en-US%22%3ERe%3A%20Counting%20unique%20entries%20and%20creating%20a%20list%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-855290%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F394231%22%20target%3D%22_blank%22%3E%40Subodh_Tiwari_sktneer%3C%2FA%3E%26nbsp%3BThanks%2C%20but%20if%20I%20use%20%22%3DUNIQUE(TRIM(A1%3AA9))%22%20I%20get%20%22%23value!%22%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-855293%22%20slang%3D%22en-US%22%3ERe%3A%20Counting%20unique%20entries%20and%20creating%20a%20list%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-855293%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F521%22%20target%3D%22_blank%22%3E%40Sergei%20Baklan%3C%2FA%3E%26nbsp%3B.%20Thanks%20Sergei.%20Still%20no%20further%20in%20identifying%20the%20problem.%20See%20attached.%20%22%3DUNIQUE%22%20is%20recognized%20but%20I%20am%20only%20getting%20a%20single%20entry%20in%20the%20formula%20cell.%20I%20can't%20work%20out%20why%20it%20is%20not%20working.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-left%22%20style%3D%22width%3A%20712px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F131783i9C2602BAFE9BBD2E%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22Capture.jpg%22%20title%3D%22Capture.jpg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-855300%22%20slang%3D%22en-US%22%3ERe%3A%20Counting%20unique%20entries%20and%20creating%20a%20list%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-855300%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F406909%22%20target%3D%22_blank%22%3E%40Tasilee%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20is%20how%20it%20works.%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F131787i62EBCBE3F79C998D%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22Unique.jpg%22%20title%3D%22Unique.jpg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPlease%20find%20the%20attached%20with%20the%20Unique%2FTrim%20formula%20in%20C2.%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-855302%22%20slang%3D%22en-US%22%3ERe%3A%20Counting%20unique%20entries%20and%20creating%20a%20list%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-855302%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F406909%22%20target%3D%22_blank%22%3E%40Tasilee%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20also%20think%20that%20you%20should%20have%20started%20your%20own%20question%20as%20it%20would%20be%20irritating%20for%20the%20OP%20as%20he%2Fshe%20might%20be%20getting%20all%20the%20notifications%20of%20replies%20being%20posted%20here%20and%20specially%20when%20the%20question%20has%20been%20marked%20as%20Solved.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-855303%22%20slang%3D%22en-US%22%3ERe%3A%20Counting%20unique%20entries%20and%20creating%20a%20list%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-855303%22%20slang%3D%22en-US%22%3E%3CP%3EThanks%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F394231%22%20target%3D%22_blank%22%3E%40Subodh_Tiwari_sktneer%3C%2FA%3E%26nbsp%3B.%20I%20downloaded%20the%20spreadsheet%20and%20opened%20it%20in%20Excel%20and%2C%20as%20previously%20from%20Sergei%2C%20the%20formula%20cell%20B2%20contains%20%22%3D_xlfn.UNIQUE(A2%3AA10)%22.%20If%20I%20click%20on%20B2%2C%20%22%7B%3D_xlfn.UNIQUE(A2%3AA10)%7D%22%20is%20actually%20displayed%20in%20the%20formula%20bar%2C%20but%20if%20I%20click%20there%2C%20the%20braces%20%7B%20and%20%7D%20dissapear.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-855332%22%20slang%3D%22en-US%22%3ERe%3A%20Counting%20unique%20entries%20and%20creating%20a%20list%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-855332%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F406909%22%20target%3D%22_blank%22%3E%40Tasilee%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThat%20simply%20means%20you%20don't%20have%20access%20to%20the%20dynamic%20array%20functions%20yet.%3C%2FP%3E%3CP%3EJoin%20the%20Office%20Insider%20program%20from%20your%20Account%20page%20and%20keep%20on%20updating%20the%20Office%20until%20you%20have%20access%20to%20the%20dynamic%20formulas.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-855618%22%20slang%3D%22en-US%22%3ERe%3A%20Counting%20unique%20entries%20and%20creating%20a%20list%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-855618%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F406909%22%20target%3D%22_blank%22%3E%40Tasilee%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EYes%2C%20I%20agree%20with%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F394231%22%20target%3D%22_blank%22%3E%40Subodh_Tiwari_sktneer%3C%2FA%3E%26nbsp%3B%2C%20Dynamic%20Arrays%20and%20all%20related%20functions%2C%20UNIQUE%20in%20particular%2C%20are%20not%20available%20for%20your%20version.%20To%20my%20knowledge%20they%20are%20deployed%20only%20for%20Insiders%20Fast%20and%20Monthly%20Targeted%20channel%2C%20not%20for%20Monthly%20channel.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-855853%22%20slang%3D%22en-US%22%3ERe%3A%20Counting%20unique%20entries%20and%20creating%20a%20list%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-855853%22%20slang%3D%22en-US%22%3E%3CP%3EThanks%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F521%22%20target%3D%22_blank%22%3E%40Sergei%20Baklan%3C%2FA%3E%26nbsp%3Band%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F394231%22%20target%3D%22_blank%22%3E%40Subodh_Tiwari_sktneer%3C%2FA%3E%3CSPAN%3E%26nbsp%3Bfor%20persevering%26nbsp%3Bwith%20this%20issue.%20It%20is%20unfortunate%20that%20the%20version%20of%20Excel%20I%20have%20doesn't%20complain%20about%20the%20%22%3DUNIQUE()%22%20formula.%20THat%20at%20least%20would%20provide%20a%20clear%20indication%20of%20the%20issue.%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E
milanolm
New Contributor

Is there a straight forward way to get Excel to count the number of unique items in a list and then total how many of each item there are? For example in the list: 4,5,6,7,4,4,5,7 I would like Excel to tell me that there are three 4's, two 5's, one 6, and two 7's.

 

I'm hoping to use this to create a relatively simple inventory counter without having to manually count each item. I am quite competant with Excel and am in the process of learning how to use Macros and VBA if they can be of any use.

 

 

19 Replies
Solution

@milanolm 

There are several ways to achieve that.

One easy way is, you can insert a Pivot Table and drag the same field you are trying to count the unique occurrences in both the Rows area and the Values area and change the value field setting to Count if the column you are working contains the numeric data.

@milanolm 

Yes, Pivot Table is the easiest in pre-DA Excel. When Dynamic Arrays appear that could be

image.png

=UNIQUE(A2:A9)

and

=COUNTIF(A2:A9,UNIQUE(A2:A9))

@Sergei Baklan I just ran across the UNIQUE function and it does exactly what I need, but it seems to only return the first value in my list. For example your "=UNIQUE(A2:A9)" is returning only "4" in the target cell. Ideally, I wanted to do something like "=UNIQUE(A2:C9)", but that is doing exactly the same and returning only the value of A2 in the formula cell. No dynamic array as expected.

@Tasilee 

=UNIQUE(A2:A9) shall return the spill with all unique items, please check the file attached. If not, could you please provide the sample.

@Subodh_Tiwari_sktneer  The pivot table worked exactly like I was hoping. Thanks!

@milanolm 

You're welcome! Glad you found it helpful.

@Sergei Baklan. Strange. The cell C2 in your Excel worksheet that I downloaded with "Save link as ..." is "=_xlfn.UNIQUE(A2:A9)".

 

If I double click the file on the community site, it opens in Google Docs and that same cell is rendered as "=ARRAY_CONSTRAIN(ARRAYFORMULA(UNIQUE(A2:A9)), 4, 1)".

 

I can't make sense of it, so I'll attach the spreadsheet with real data where I am trying to list unique rows. The failing formula "=UNIQUE(M2:O510)" is in cell U2.

 

 

 

 

@Tasilee 

xlfn means your version of Excel doesn't support dynamic arrays, in particular UNIQUE function. So far it's available for Office 365 subscribers on Insiders channels.

https://support.office.com/en-us/article/issue-an-xlfn-prefix-is-displayed-in-front-of-a-formula-882...

 

@Sergei Baklan . I have Office 365, but I re-installed it just to make sure. Excel also accepts the formula "=unique(A1:A9)" so it knows about, but it just places what looks like the A1 value into the formula cell, and no other cells are populated.

 

I have no idea why this behaviour is occuring. If I search in Help for "unique" I get link to use Data |  Sort/Filter | Advanced | Copy to ("B1") Unique records only. If I have in A1:A9

 

a

a

b

c

b

a

d

d

d

 

and I get in B1:B5

 

a

a

b

c

d

 

Even this is not correct. 

 

 

 

 

@Tasilee 

Check all the 'a' values in the range used in the formula. One of 'a' must be having a leading or a trailing space in it and that's why it's picking two 'a' values.

In C1, place the formula =LEN(A1) and copy it down and check the length returned for all the 'a' values and you will find that the length of all the 'a' values is not 1.

 

Or you should try this formula which should return the correct output ignoring any leading or trailing spaces.

=UNIQUE(TRIM(A1:A9))

@Tasilee 

If you have UNIQUE from Excel with Dynamic Arrays, Help shall show something like

image.png

What you speak about that's Advanced filter. It consider first cell in the list as column label. In your case that's A1. Thus first "a" is considered as list name, not as data. More correct will be like

image.png

And word exactly is your Excel channel and build? You may find info in File->Account

image.png

@Subodh_Tiwari_sktneer Thanks, but if I use "=UNIQUE(TRIM(A1:A9))" I get "#value!"

@Sergei Baklan . Thanks Sergei. Still no further in identifying the problem. See attached. "=UNIQUE" is recognized but I am only getting a single entry in the formula cell. I can't work out why it is not working.

 

Capture.jpg

@Tasilee 

This is how it works.

Unique.jpg

 

Please find the attached with the Unique/Trim formula in C2.

 

 

@Tasilee 

I also think that you should have started your own question as it would be irritating for the OP as he/she might be getting all the notifications of replies being posted here and specially when the question has been marked as Solved.

Thanks @Subodh_Tiwari_sktneer . I downloaded the spreadsheet and opened it in Excel and, as previously from Sergei, the formula cell B2 contains "=_xlfn.UNIQUE(A2:A10)". If I click on B2, "{=_xlfn.UNIQUE(A2:A10)}" is actually displayed in the formula bar, but if I click there, the braces { and } dissapear.

@Tasilee 

That simply means you don't have access to the dynamic array functions yet.

Join the Office Insider program from your Account page and keep on updating the Office until you have access to the dynamic formulas.

@Tasilee 

Yes, I agree with @Subodh_Tiwari_sktneer , Dynamic Arrays and all related functions, UNIQUE in particular, are not available for your version. To my knowledge they are deployed only for Insiders Fast and Monthly Targeted channel, not for Monthly channel.

Thanks @Sergei Baklan and @Subodh_Tiwari_sktneer for persevering with this issue. It is unfortunate that the version of Excel I have doesn't complain about the "=UNIQUE()" formula. THat at least would provide a clear indication of the issue.