Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/google-sheets/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
If statement 为Google工作表中的每个重复字符串分配序列号_If Statement_Google Sheets_Array Formulas_Counting_Countif - Fatal编程技术网

If statement 为Google工作表中的每个重复字符串分配序列号

If statement 为Google工作表中的每个重复字符串分配序列号,if-statement,google-sheets,array-formulas,counting,countif,If Statement,Google Sheets,Array Formulas,Counting,Countif,我希望为在Google工作表中重复的行分配一个不同的值。下面是从查询中提取的当前工作表的示例 School Comp # Name School 1 3 Student A School 1 4 Student B School 2 10 Student C School 3 15 Student D School 3 20 Student E School 4 25 Student F 预期结果 Athlete # School

我希望为在Google工作表中重复的行分配一个不同的值。下面是从查询中提取的当前工作表的示例

School   Comp #  Name
School 1    3   Student A
School 1    4   Student B
School 2   10   Student C
School 3   15   Student D
School 3   20   Student E
School 4   25   Student F
预期结果

Athlete #   School  Comp #  Name
Athlete 1   School 1    1   Student A
Athlete 2   School 1    2   Student B
Athlete 1   School 2    3   Student C
Athlete 1   School 3    4   Student D
Athlete 1   School 4    5   Student E
Athlete 1   School 5    6   Student F
由于学校可能会派出1名或2名运动员,我试图根据学生是否是学校注册的第一名或第二名运动员,自动将他们分配到预赛/赛道

下面是我正在使用的示例工作表的副本:

试试看:

=ARRAYFORMULA(IF(A:A="",,"Athlete "&COUNTIFS(A:A, A:A, ROW(A:A), "<="&ROW(A:A))))

=ARRAYFORMULA(如果(A:A=”“,“运动员”和COUNTIFS(A:A,A:A,行(A:A),“谢谢你的建议。不幸的是,它似乎没有生成运动员(1或2)除了学校之外,根据需要-在实时电子表格上,它将学校1分配为2名运动员1,并将学校3的第一个条目分配为运动员2,而不是运动员1。我正在使用。你能分享一份你的实时表格吗?它有个人数据,所以我不能-但我确实借用了你的建议,只是删除了“运动员”一词“部分,不管怎么说,这真的是无关紧要的。我使用了公式=if(isblank(I3),”,countif($I$3:I3,I3)),它完美地为每个学校的运动员贴上了1或2的标签。谢谢你把我放在右边track@NicoleBatte