简体   繁体   English

Google表格:按一列分组并按两列排名

[英]Google Sheets : Group By one column and Rank by 2 columns

I have a table like below where I need to group by column A and determine rank/priority based on the logic below:我有一个如下表,我需要按 A 列分组并根据以下逻辑确定排名/优先级:

These are the steps I would like to do :这些是我想做的步骤:

  • First Group by column A第一个按 A 列分组
  • Then check column B for each group.然后检查每个组的 B 列。 The lower the start date, the smaller the rank for example if the dates are 2022 and 2023, 2022 will get rank 1 and 2023 will get rank 2 and so on ...开始日期越低,排名越小,例如,如果日期是 2022 年和 2023 年,则 2022 年将获得排名 1,而 2023 将获得排名 2,依此类推...
  • If the start years are the same for rows, then check column C and assign rank based on the Impact.如果行的起始年份相同,则检查 C 列并根据影响分配排名。 Higher the impact, lower the rank.影响越大,排名越低。 For example if 2 rows have start year 2022 then if impact is 100 for one row and 50 for the other, impact with 100 will get rank 1 and 50 will get rank 2 and so on ...例如,如果 2 行的起始年份为 2022 年,那么如果其中一行的影响为 100,另一行的影响为 50,则 100 的影响将获得排名 1,而 50 的影响将获得排名 2,依此类推......

Please see picture for sample data and expected output in column D请参阅图片以获取 D 列中的示例数据和预期输出

I have tried this function but it only gives me rank based on one column - https://infoinspired.com/google-docs/spreadsheet/rank-group-wise-in-google-sheets/我已经尝试过这个功能,但它只给我基于一列的排名 - https://infoinspired.com/google-docs/spreadsheet/rank-group-wise-in-google-sheets/

Also clarifying that Column D is what I would like to generate through the formula.还要澄清 D 列是我想通过公式生成的。 I was just showing that as expected output in the image.我只是在图像中显示了预期的输出。 We don't have that available and need to generate that rank from columns A, B and C!我们没有可用的,需要从 A、B 和 C 列生成该排名!

Any ideas/thoughts are appreciated!任何想法/想法表示赞赏! Thank you!谢谢!

You can use the following您可以使用以下

=SORT(A2:D13,1,1,2,1,3,0)

( Do adjust the formulae according to your ranges and locale) 根据您的范围和语言环境调整公式)

在此处输入图像描述

Read about SORT阅读关于排序

Get rank by group按组获取排名

I understand that you want to determine the rank by group based on columns A, B and C.我了解您希望根据 A、B 和 C 列按组确定排名。

1 - First of all, we get the score from 0 to 100 to keep it readable, by creating a helper column shown in yellow, Paste the following formula in E2 . 1 - 首先,我们通过创建一个黄色显示的辅助列,将分数从 0 到 100 以保持可读性,将以下公式粘贴E2中。

=ArrayFormula(IF(A2:A="",,(ArrayFormula(B2:B13*C2:C13)/MAX(ArrayFormula(B2:B13*C2:C13)))*100))

在此处输入图像描述

Explanation解释

1.a - Multiply the ranges B2:B13*C2:C13 Date*Impact in that way the greater the date and the greater the impact is the greater the output. 1.a - 将范围B2:B13*C2:C13 Date*Impact 相乘,日期越大,影响越大,输出越大。

ArrayFormula allows for the usage of non-array functions with arrays and the ability to show values returned by an array formula over many rows and/or columns. ArrayFormula允许将非数组函数与数组一起使用,并能够在许多行和/或列上显示数组公式返回的值。

1.b - Divide / by MAX of the output and multiply * by 100 1.b - 除以/除以输出的MAX并将*乘以 100

2 - Paste this formula in F2 and drag down to get rank by group. 2 - 将此公式粘贴F2中并向下拖动以按组获得排名。

=Rank(E2,Filter($E$2:$E$13,$A$2:$A$13=A2),0)

在此处输入图像描述

Explanation ...解释...

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在 Google 表格中将两列表转换为一个列表 - Converting two columns table into one column table in Google Sheets 用于乘以 2 列的 Google Sheets ArrayFormula 解决方案,其中一列是一列数字列表 - Google Sheets ArrayFormula Solution for Multiplying 2 Columns, One of Which Is a Column of Lists of Numbers 如何根据Google表格中的布尔值将行合并为一列? - How to combine rows into one column based on boolean values in Google Sheets? 如何收集谷歌表格中一列下的所有回复 - How to collect all responses under one column in google sheets IMPORTRANGE可以将多个Google表格导入到一个垂直列中? - IMPORTRANGE to import multiple Google Sheets into one vertical column? 在谷歌表格中匹配索引两列条件和一行条件 - Match index two column criteria and one row criteria in google sheets Google表格,数组公式将2张表格合并为一张,并附加一个新列以指定数据来自哪个表格 - Google Sheets, Array Formula to merge 2 Sheets into one, and append a new column to specify which sheet the data came from Google表格会返回多列 - Google Sheets return multiple columns Google 表格:将列与复选框进行比较 - Google Sheets: Comparing Columns with Checkboxes 是否有一个谷歌表格公式可以采用一系列单元格,并按字母顺序在一个单独的列中列出所有单元格? - Is there a Google Sheets formula that can take a range of cells, and list all the cells in one separate column, alphabetically?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM