Jun 20 2024 07:04 AM - edited Jun 20 2024 07:13 AM
Hi, not feeling too smart here. How do I code Excel to make the result table below, counting number of unique occurrences of fruit types across 3 columns? Col1 etc refer to Table columns in DataTable in the Data sheet. So I presume the array to count in is Data!DataTable[[Col1]:[Col3]] or something like that? And not sure what function to use. Thank you.
Jun 20 2024 07:12 AM
@Officeuser7777 Not a very fancy solution but it could similar to the one in the attached file.
Jun 20 2024 07:19 AM
Which Excel version are you using?
Jun 20 2024 07:24 AM
@Officeuser7777 Perhaps Power Query is something you would want to consider. Especially when your real data is more complicated than just Apples and Bananas 🙂
Jun 20 2024 07:27 AM
Jun 23 2024 02:24 AM
Jun 23 2024 02:53 AM - edited Jun 23 2024 02:54 AM
Not sure what got you 'bumped' or what SUMPRODUCT solution you saw. Perhaps the picture below will help, though you should be able use my initial formula suggestion with UNIQUE, TOCOL and COUNTIF in Excel for MS635.
Jun 23 2024 03:04 AM
Jun 23 2024 04:40 AM
Are you sure you are on Mac and your excel is 365? If it is indeed 365 for Mac, then it is impossible that you cannot use UNIQUE or TOCOL.
Without UNIQUE or TOCOL, you need to do something like below. (it is not something that can be solved by SUMPRODUCT).
Feel free to complain about your excel 365 or mac to the relevant custom support if you find the attached legacy solution too painful.
Jun 23 2024 05:07 AM
Jun 23 2024 05:30 AM
=HSTACK(UNIQUE(TOCOL(DataTable,1)),BYROW(UNIQUE(TOCOL(DataTable,1)),LAMBDA(r,SUM(N(DataTable=r)))))
The attached sample file should work if i correctly understand what you want to do. The formula dynamically updates the results when data is entered in the dynamic table "DataTable".
Jun 23 2024 10:05 AM
SolutionIt may already have been suggested but COUNTIFS works perfectly well with 2D Ranges.
fruit
= UNIQUE(TOCOL(Tabelle1,1))
count
= COUNTIFS(Tabelle1, fruit)
Jun 24 2024 03:07 AM
Peter and Oliver, thank you. That worked great. Wish I could tag you both with best answer.
Jun 23 2024 10:05 AM
SolutionIt may already have been suggested but COUNTIFS works perfectly well with 2D Ranges.
fruit
= UNIQUE(TOCOL(Tabelle1,1))
count
= COUNTIFS(Tabelle1, fruit)