所以, 在我的其他生命我其实是一名科学教师, 并且,往往会让一轮我“好了电脑”我通常会问到有没有看看几件事情。两次在过去的几个月中,我一直在问我是否愿意设立条件格式在Excel相比,他们的目标产品用颜色标记学生的考试成绩。虽然不完全与这个网站的核心内容, 它还是 DIY 技术帮助,所以我决定在这里发布全套说明。享受…
首先你需要一个查找表
- Create a new sheet in the workbook.
- 填写 2 列 - 左边有傲人的成绩 (1Ç, 1b, 1一个, 2Ç等。) 并用“得分”值的权利 (可以只是 1, 2, 3, 4, 5 等等)
- 填写 2 additional columns with a “reverse lookup” which is the same as before but with the 2 列对调
- Highlight the full left hand table that you’ve created, 右键单击它, 并选择“定义名称”。给它一个名字, e.g. “lookup”
- Highlight the second table you created, right click and define another name. Give it a name, e.g. “reverse_lookup”
创建工作表
- Now create a worksheet for each class, 组或年 (西服). Include a column for target grades and various columns for test or assessment results (e.g. 如下)
- Note in this example that target data is in C3 – C5. Results are in D3 – F5
构建基本条件格式
- Select cell D3 – the top left of the results data cells. Make sure you are on the “home” tab and click on “conditional formatting” and select “new rule”
- Select “use a formula to determine which cells to format”
- What we want to do is compare the current cell to the target, 但它并不像这么简单, because of the way excel compares values – so we need to use the lookup tables.
- 我们还需要 5 规则 - 2 sublevels or more below, 1 下面, on target, 1 与以上 2 or more above. You can create more rules if you want more detail or less if you just want below, 对以上目标.
- The eventual formula for 2 sublevels or more below will be
=VLOOKUP($C3,Lookup,2,FALSE)-1>VLOOKUP(D3,Lookup,2,FALSE)
- The C3 in the first part refers to the top target cell, and the D3 refers to the top actual result cell. The “Lookup” refers to the lookup table range that we named earlier.
- To break this down – we’re looking up numerical values for both the target and the actual score in the current cell. Because we want 2 sublevels or more below we take 1 off the target and say it must still be greater than the score. The $ before the C of C3 ensures that when we use the same formula for other columns they will still be compared to the targets column.
- Now click on format and apply the formatting you want. I use a background colour of light red
- Now we have created 1 的 5 用于单个小区的规则.
扩大对多条规则的条件格式
- Next repeat the process to create 4 更多的规则.
- When all are finished my 5 examples would look as below. Only the comparison and possible addition or subtraction change between them. Also note the order (我们来到下一个)
=VLOOKUP($C3,Lookup,2,FALSE)-1>VLOOKUP(D3,Lookup,2,FALSE) =VLOOKUP($C3,Lookup,2,FALSE)>VLOOKUP(D3,Lookup,2,FALSE) =VLOOKUP($C3,Lookup,2,FALSE)=VLOOKUP(D3,Lookup,2,FALSE) =VLOOKUP($C3,Lookup,2,FALSE)+1<VLOOKUP(D3,Lookup,2,FALSE) =VLOOKUP($C3,Lookup,2,FALSE)<VLOOKUP(D3,Lookup,2,FALSE)
- I use medium red, 红灯, yellow, medium green and light green (在该顺序) for background colours
排序的规则的顺序
- 最后, 我们需要确保这些规则以正确的顺序, and apply them to ALL the results cells, not just the single result cell D3.
- Click on the conditional formatting button again and choose “manage rules…”
- 确保这些规则以正确的顺序 - 如上 (medium red, 红灯, yellow, medium green, 葱绿)
- Click in the “Applies to” box and enter the full range of cells which will contain results. In my example this is
=$D$3:$F$5
. 把这个在所有 5 “适用于”盒子 - This sheet should now fully work with conditional formatting
很容易扩展到其他工作表
- To apply to other sheets simple copy and paste a single cell which already has conditional formatting applied to it, 进入新的工作表.
- Then click on the conditional formatting button, select manage rules, 并改变 5 “applies to” boxes to point to the cells of the new sheet which need conditional formatting
你好,约翰,
你有你制作的表格的例子吗? Struggling following the steps here!
I would love to re-post this article on my own website, 会是这样好吗?
确定, as long as you drop in a link to the original article here 🙂
你好,
Great tutorial — thanks. 我有 3 different colours working perfectly but the 2 与以上 2 below aren’t formatting to their correct colours. They are changing to red and green but not the shades that they need to change to. Any suggestions please?
谢谢,
加里
Sorry for the long delay in replying Gary — I’ve been busy migrating the site to our new VPS. Did you manage to get this sorted? If you didn’t then by all means zap me over your excel file to have a look at. 我会在第二天重新检查本指南或 2 to make sure there aren’t any typo’s or misleading parts, 人们知道发生😉
I have followed all your instructions above but none of my cells have gone coloured?? Any suggestions where I’m going wrong??
I assume you have populated them with data, and the target column is also populated with data?
By all means zap me the file over and I’ll take a quick look — I’ve e‑mailed you