这是我的数据库:
Name| 1st | 2nd | 3rd | 4th | 5th
Ann | five | five | four | five | one
Tom | four | one | four | five | four
我想做的是创建包含一行中出现次数的列,因此在这种情况下,我要实现的目的是
Name| 1st | 2nd | 3rd | 4th | 5th | Five| Four | One
Ann | five | five | four | five | one | 3 | 1 | 1
Tom | four | one | four | five | four | 1 | 3 | 1
答案 0 :(得分:1)
理想情况下,您要取消数据显示,使其看起来像这样:
Name | Number | Value
-----|--------|------
Ann | 1st | five
Ann | 2nd | five
Ann | 3rd | four
Ann | 4th | five
Ann | 5th | one
Tom | 1st | four
Tom | 2nd | one
Tom | 3rd | four
Tom | 4th | five
Tom | 5th | four
然后,您可以通过将Name
放在行上,Value
放在列上,并将Number
的计数放在值字段中来轻松地创建矩阵视觉,
我不建议这样做,但是如果您需要将其保留在当前布局中,那么您计算出的列可以写为:
Five = (TableName[1st] = "five") + (TableName[2nd] = "five") + (TableName[3rd] = "five") +
(TableName[4th] = "five") + (TableName[5th] = "five")
Four
和One
列的公式类似。
答案 1 :(得分:0)
我在这里有类似的问题,但是我的数据帧在列方面不是固定的,我的意思是,对于数据库的下一次刷新,列数可能会更改为更大(更多列)或最小(更少列),也许列标题的名称也发生了变化...在这种情况下,我无法传递列名称或索引以进行计数器查找,无论多少列或名称,公式都需要查看整行。 >