No, I've never won the lottery, but that's probably because I don't buy tickets! Your odds of winning improve (slightly) if you actually have a ticket for the draw.
不,我从未赢过彩票,但这可能是因为我不买票! 如果您确实有抽奖券,则中奖几率会有所提高。
However, there are many workplaces where someone has organized a weekly lottery pool, and they have a batch of ticket numbers to check.
但是,在许多工作场所中,有人每周组织一次彩票池,并且要检查一批票号。
Instead of checking those numbers manually (and missing one or two!), you can use Excel to check them for you. It won't even ask for a percentage, if you are lucky enough to win a prize.
您可以使用Excel为您检查这些数字,而不必手动检查这些数字(丢失一个或两个!)。 如果您足够幸运能赢得奖金,它甚至不会要求一定的百分比。
设置工作表 (Set Up the Worksheet)
In this example, the winning numbers have been entered at the top of a worksheet, in cells C3:H3.
在此示例中,中奖号码已输入到工作表顶部的单元格C3:H3中。
Below that, all the tickets numbers have been entered, in cells C6:H8.
在下面,在单元格C6:H8中输入了所有票证编号。
![lotterywinners02 lotterywinners02](https://i-blog.csdnimg.cn/blog_migrate/1cb5957869d5d1b89e7f3652180f4ef4.png)
突出显示中奖号码 (Highlight the Winning Numbers)
After all the numbers are entered, you can use conditional formatting to highlight the ticket numbers that were selected in the weekly draw. We'll use the COUNTIF function in the conditional formatting rule, just as it could be used on the worksheet.
输入所有号码后,您可以使用条件格式突出显示在每周抽奖中选择的票证号码。 我们将在条件格式设置规则中使用COUNTIF函数 ,就像可以在工作表上使用它一样。
- Select cells C6:H8 – cell C6 is the active cell in the selection, so it will be used as a reference in the conditional formatting rule. 选择单元格C6:H8 –单元格C6是所选内容中的活动单元格,因此它将用作条件格式设置规则中的参考。
- On the Ribbon's Home tab, click Conditional Formatting, then click New Rule 在功能区的“主页”选项卡上,单击“条件格式”,然后单击“新规则”。
- Click "Use a Formula to Determine Which Cells to Format" 单击“使用公式来确定要格式化的单元格”
For the formula, use the COUNTIF function:
对于公式,请使用COUNTIF函数:
=COUNTIF($C$3:$H$3,C6)>=1
= COUNTIF($ C $ 3:$ H $ 3,C6)> = 1
- Click the Format button. 单击格式按钮。
- Select formatting options (green fill, in this example), click OK 选择格式选项(在此示例中为绿色填充),单击“确定”。
- Click OK 点击确定
The COUNTIF formula checks the cells with the weekly draw numbers (C3:H3), and counts how many times the value in cell C6 is in that range.
COUNTIF公式使用每周抽奖编号(C3:H3)检查单元格,并计算单元格C6中的值在该范围内的次数。
- The reference to $C$3:$H3 is absolute, because all the cells should check that range for winning numbers. 对$ C $ 3:$ H3的引用是绝对的,因为所有单元格都应检查该范围的中奖号码。
- The reference to C6 is relative, because it should adjust, for each cell in the ticket number range – C6:H8 对C6的引用是相对的,因为它应该针对票证编号范围内的每个单元格进行调整– C6:H8
![lotterywinners03 lotterywinners03](https://i-blog.csdnimg.cn/blog_migrate/f750a3f3034774a23301a03b3850b090.png)
下载样本文件 (Download the Sample File)
To see how the conditional formatting works, you can download the sample file from my website, on the Conditional Formatting Examples page.
要查看条件格式的工作原理,可以从我的网站上的“ 条件格式示例”页面下载示例文件。
观看视频 (Watch the Video)
You can watch this short video, to see how the conditional formatting is set up.
您可以观看此短片,以了解如何设置条件格式。
Or watch on YouTube: Highlight Winning Lottery Numbers
或在YouTube上观看: 突出显示中奖号码
翻译自: https://contexturesblog.com/archives/2015/03/12/highlight-winning-lottery-numbers/