Excel在与相应类别匹配的名称后计算唯一出现次数。

huangapple go评论54阅读模式
英文:

Excel counting the number of unique occurrences after matching the name with corresponding category

问题

需要帮助匹配教师和学生,并仅计算来自该列的学生的单个发生次数。输出应包括发生次数和相应的居住国家。

预期输出:

               教师   地点    数量
               Iwin    伦敦     3
                        纽约     1
               Rice    纽约     1
                        德国     1
                        英国     1
                        巴西     2

输入:

                姓名    学生     地点
                Iwin     John    伦敦
                Iwin     John    伦敦
                Iwin     Ron      伦敦
                Iwin     Emil    纽约
                Rice     Jacob  纽约
                Rice     Rui       德国
                Rice     erin     英国
                Rice     erin     英国
                Rice     erin     英国
                Rice     josh    巴西
                Iwin     Gary    伦敦
                Rice     Meca  巴西
英文:

Need help with matching Teacher with students and counting only a single occurrence of students from the column. Output to include the number of occurrences and the corresponding country of residence.

Expected output:

               Teacher Place   No
               Iwin    London  3
                       Newyork 1
               Rice    Newyork 1
                       Germany 1
                       Britan  1
                       Brazil  2

Input:

                Name  students	Place
                Iwin	John	London
                Iwin	John	London
		        Iwin	Ron	    London
		        Iwin	Emil	Newyork
		        Rice	Jacob	Newyork
		        Rice	Rui	    Germany
                Rice	erin	Britan
                Rice	erin	Britan
                Rice	erin	Britan
                Rice	josh	Brazil
		        Iwin	Gary	London
		        Rice	Meca	Brazil

答案1

得分: 2

你可以制作一个唯一列表,将其放入表格中,然后制作一个数据透视表。

英文:

You could make a unique list, take it to a table and then make a pivot table.

Excel在与相应类别匹配的名称后计算唯一出现次数。

答案2

得分: 1

A16 = UNIQUE(CHOOSECOLS(UNIQUE(A2:C13);1;3))
C16 = SUM((A16&B16=($F$3:$F$11&$H$3:$H$11)*1)

要达到您想要的精确结果,您可以使用条件格式隐藏出现多次的名称。将文本颜色设置为白色,或更改单元格的数字格式为如下所示:

;;;

英文:
A16	=UNIQUE(CHOOSECOLS(UNIQUE(A2:C13);1;3))
C16	=SUM((A16&B16=($F$3:$F$11&$H$3:$H$11))*1)

To get the outcome exact as you want you can hide the Names which occure more than one with conditional formating. Make the text color white or to change the numberformat of the cell to something like this:

;;;

Excel在与相应类别匹配的名称后计算唯一出现次数。

This picture shows the conditional formatting.
Excel在与相应类别匹配的名称后计算唯一出现次数。

Excel在与相应类别匹配的名称后计算唯一出现次数。

答案3

得分: 0

要获取计数,您可以对每一行的名称、学生和地点列使用TEXTJOIN函数。假设您提供的输入数据从列A的第1行开始,公式将如下所示:

=TEXTJOIN("_",, A2:C2)

在您放置该函数的单元格中,应该会得到Iwin_John_London。假设我们将其放在列D的第2行。现在,您可以对其余行进行自动填充,然后对最近创建的输出使用UNIQUE函数:

=UNIQUE(D2:D13)

现在,我们可以从我们创建的唯一列中提取老师的名字和地点。假设唯一数据从列E的第2行开始,公式将如下所示:

=TEXTJOIN("_",, LEFT(E2, SEARCH("_", E2, 1) - 1), RIGHT(E2, LEN(E2) - SEARCH("_", E2, SEARCH("_", E2) + 1)))

对于第一个单元格,您应该得到Iwin_London。现在,我们需要进行另一个自动填充,然后在列F中刚刚输出的数据上使用UNIQUE函数:

=UNIQUE(F2:F10)

最后,我们可以使用COUNTIF + 自动填充来查找列GF上的所需计数:

=COUNTIF(F2:F10, G2)

这就是所有数据应该看起来的样子。

英文:

To get the counts you can textjoin the name, students and place columns for each row. Let say the input data you've provided starts in column A row 1, the formula would look like this:

=TEXTJOIN("_",, A2:C2)

You should get this Iwin_John_London in cell where you put the function. Lets say we put it in column D row 2. Now, you autofill for the rest of the rows and then use unique on the recently created output:

=UNIQUE(D2:D13)

Now we can extract the teacher's name and the place from the unique column we created. Lets say it the unique data starts in column E row 2. The formula would look like this:

=TEXTJOIN("_",, LEFT(E2, SEARCH("_", E2,1)-1), RIGHT(E2, LEN(E2) - SEARCH("_", E2, SEARCH("_", E2)+1)))

You should get this for the first cell Iwin_London. We now have to do another autofill. Then a unique in the data we just outputted in column F.

=UNIQUE(F2:F10)

Finally, we can do a countif + autofill to find the desired counts with the data on column G and F:

=COUNTIF(F2:F10,G2)

This is what all the data should look like:
Excel在与相应类别匹配的名称后计算唯一出现次数。

huangapple
  • 本文由 发表于 2023年3月4日 02:53:13
  • 转载请务必保留本文链接:https://go.coder-hub.com/75630861.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定