if(rank==0){_Excel RANK IF公式示例

if(rank==0){

Excel has a RANK function, so you can calculate where each number stands in a list of numbers. There isn't a RANKIF function though, if you need to rank based on criteria. Someone asked me for help with ranking daily sales, so I used COUNTIFS to make an Excel Rank If formula.

Excel具有RANK函数,因此您可以计算每个数字在数字列表中的位置。 如果您需要根据条件进行排名,则没有RANKIF函数。 有人向我求助,以对每日销售额进行排名,因此我使用COUNTIFS制定了Excel Rank If公式。

排名每日销售额 (Rank Daily Sales)

The goal of the Rank If formula in this example is to rank each day's sales, compared to other days in the same week. If we just use Excel's RANK function, it would compare each day to all the other days in the list.

此示例中的“如果排名”公式的目标是对与同一周中的其他几天相比的每一天的销售额进行排名。 如果仅使用Excel的RANK函数,它将每天与列表中的所有其他天进行比较。

In the screen shot below, you can se the first few rows of the sample data. The sales records for two weeks are visible.

在下面的屏幕快照中,您可以查看示例数据的前几行。 可以看到两周的销售记录。

  • In week 1, Jan 2nd and Jan 4th have the highest sales, so they should be tied at rank of 1.

    在第1周,1月2日和1月4日的销售额最高,因此应该并列第1名。
  • In week 2, Jan 10th has the highest sales, so it should have a rank of 1 for that week.

    在第2周,1月10日的销售额最高,因此该周的排名应该为1。

准备好对销售进行排名 (Get Ready to Rank the Sales)

To manually rank the items largest to smallest for each week, we could count how many items are larger than each item.

要手动将每周的商品从大到小排序,我们可以计算出比每个商品大多少个商品。

  • In week 1, there are zero items with amounts larger than the Jan 2nd sales.

    在第1周,零商品的数量大于1月2日的销售额。
  • The rank for Jan 2nd is 1.

    1月2日的排名是1。
  • Using that information, we have a way to calculate the rank -- the number of items larger, plus 1

    利用这些信息,我们可以计算排名-较大的项目数加1

使用COUNTIFS计算RANK IF (Use COUNTIFS to Calculate RANK IF)

The COUNTIFS function lets us count based on multiple criteria, so we'll use that to create an Excel Rank IF formula.

COUNTIFS函数使我们可以基于多个条件进行计数,因此我们将使用它来创建Excel Rank IF公式。

For our criteria, we need to count:

根据我们的标准,我们需要计算:

  • other sales with the same week number

    同一周号的其他销售
  • sales larger than the current row

    销量大于当前行

Then, after COUNTIFS gives us that count, we'll add 1 to get the rank.

然后,在COUNTIFS给我们该计数之后,我们将加1来获得排名。

To see more COUNTIFS examples, go to the the Count Functions page on my Contextures website.

要查看更多COUNTIFS示例,请转到Contextures网站上的Count Functions页面。

排名IF公式 (The Rank IF Formula)

Here's the Rank If formula that I used for this example:

这是我在此示例中使用的Rank If公式:

=COUNTIFS([Wk], [@Wk], [Sales], ">"&[@Sales])+1

= COUNTIFS([Wk],[@ Wk],[Sales],“>”&[@ Sales])+ 1

The first criterion in the formula checks for other sales with the same week number:

公式中的第一个条件将检查其他具有相同星期编号的销售:

=COUNTIFS([Wk], [@Wk]

= COUNTIFS([Wk],[@Wk]

The second criterion find items with a larger amount in the Sales column.

第二个条件在“销售”列中查找金额较大的项目。

[Sales],">"&[@Sales])

[销售],“>”&[@销售])

Then, 1 is added to that number, to get the ranking.

然后,将该数字加1,以获得排名。

+1

+1

查看排名 (Check the Ranking)

To check the ranking in week 1, look at the sales for Jan 3rd -- 237.

要查看第1周的排名,请查看1月3日-237的销售情况。

  • There are 2 dates with a larger sales in week 1 -- Jan 2nd and Jan 4th

    第1周-1月2日和1月4日有2个销售量较大的日期
  • Add 1 to that number, and Jan 3rd has a rank of 3

    给该数字加1,1月3日的排名为3

下载样本文件 (Download the Sample File)

To download the sample file, go to the and RANK Function page on my Contextures website. The file is in xlsx format, and does not contain macros. It contains other RANK examples too.

要下载示例文件,请转到我的Contextures网站上的和RANK功能页面。 该文件为xlsx格式,不包含宏。 它还包含其他RANK示例。

翻译自: https://contexturesblog.com/archives/2017/03/09/excel-rank-formula-example/

if(rank==0){

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值