计算Googlesheets中的VIP级别

时间:2019-12-20 20:57:47

标签: google-sheets google-sheets-formula

我必须解决根据用户的每月表现为他们分配正确的VIP级别的问题。如果达到了分数,则将用户转移到特定级别。 我可以使用filter函数轻松实现这一点。 现在,要保持上个月的状态,用户必须至少达到一定数量的积分。如果他不这样做,他将被降级为以前的级别。

示例:

VIP级别如下:

+---------+----------+------------+------------+-------------------+
| level # | Level    | Min Points | Max Points | Keep level Points |
+---------+----------+------------+------------+-------------------+
| 1       | BRONZE   | 0          | 1875       | 0                 |
+---------+----------+------------+------------+-------------------+
| 2       | SILVER   | 1875       | 9375       | 1875              |
+---------+----------+------------+------------+-------------------+
| 3       | GOLD     | 9375       | 37500      | 9375              |
+---------+----------+------------+------------+-------------------+
| 4       | PLATINUM | 37500      | 93750      | 37500             |
+---------+----------+------------+------------+-------------------+
| 5       | DIAMOND  | 93750      | 187500     | 93750             |
+---------+----------+------------+------------+-------------------+
| 6       | ASTEROID | 187500     | 562500     | 187500            |
+---------+----------+------------+------------+-------------------+

例如,如果用户在一个月内产生了40000点,那么他将被提升为PLATINUM。这也意味着下个月,如果他没有达到更高的水平(钻石或ASTEROID),则需要至少产生37500点才能保持水平,否则他将被降级为黄金。

以一个特定的用户示例为例,我可以构建一个模型来查找每个月的正确级别,但是使用几行来遍历月份。 (googlesheet here

可以通过以下结果进行总结:

+-------+---------+---------+---------+---------+---------+---------+
| Month | 07-2019 | 08-2019 | 09-2019 | 10-2019 | 11-2019 | 12-2019 |
+-------+---------+---------+---------+---------+---------+---------+
| UserX | 1765    | 15408   | 1383    | 1499    | 9379    | 4161    |
+-------+---------+---------+---------+---------+---------+---------+
| Level | BRONZE  | GOLD    | SILVER  | BRONZE  | GOLD    | SILVER  |
+-------+---------+---------+---------+---------+---------+---------+

现在,拥有数百个用户,我想找到一个公式来计算每个月的正确级别,而无需使用几行来这样做(仅每位用户1行)

有人可以帮忙找出解决方案吗?

1 个答案:

答案 0 :(得分:2)

粘贴您需要的位置,然后拖动到右侧:

=ARRAYFORMULA(IF($A4:$A9="",,IFNA(VLOOKUP(B4:B9, 
 {0,      "BRONZE"; 
  1875,   "SILVER";
  9375,   "GOLD";
  37500,  "PLATINUM";
  93750,  "DIAMOND";
  187500, "ASTEROID"}, 2, 1))))

0

spreadsheet demo


更新:

在B13中的上方公式中向下排序1个使用,然后在C13中粘贴此公式并向右拖动:

=ARRAYFORMULA(IFNA(VLOOKUP(IF(IF($A4:$A9="",,IFNA(VLOOKUP(C4:C9, 
 {0, 1; 1875, 2; 9375, 3; 37500, 4; 93750, 5; 187500, 6}, 2, 1)))+1< IF($A4:$A9="",,IFNA(VLOOKUP(B4:B9, 
 {0, 1; 1875, 2; 9375, 3; 37500, 4; 93750, 5; 187500, 6}, 2, 1))),   IF($A4:$A9="",,IFNA(VLOOKUP(B4:B9, 
 {0, 1; 1875, 2; 9375, 3; 37500, 4; 93750, 5; 187500, 6}, 2, 1)))-1, IF($A4:$A9="",,IFNA(VLOOKUP(C4:C9, 
 {0, 1; 1875, 2; 9375, 3; 37500, 4; 93750, 5; 187500, 6}, 2, 1)))), 
 {1, "BRONZE"; 
  2, "SILVER";
  3, "GOLD";
  4, "PLATINUM";
  5, "DIAMOND";
  6, "ASTEROID"}, 2, 0)))

0

spreadsheet demo