Multi-column vlookup conditional formatting

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-04 04:51:38

问题


I'm looking to create a conditional format for a worksheet based on a couple of things.

Sheet 1:

Reference: "Date" = Col1 Row1

    Date    Census          RN's On Schedule                
            7a  3p  11p     7a  3p  11p     
    1-Oct   8   8   9       8   8   9       
    2-Oct   10  14  13      13  16  13      
    3-Oct   10  12  12      12  12  10      
    4-Oct   12  10  10      11  11  10      
    5-Oct   10  11  11      11  12  11      
    6-Oct   10  11  14      11  12  12      
    7-Oct   13  12  12      12  14  12      

Sheet 2:

Reference: "Census" = Col1 Row1

Census  RN Staffing Needs       
        7a  3p  11p     
1       2   2   2       
2       2   2   2       
3       2   2   2       
4       3   3   2       
5       4   4   3       
6       4.5 5   5       
7       5   6   6       
8       6   7   6.5     
9       7   8   7       
10      8.5 9   8.5     
11      10  11  10      
12      12  12  11.5    
13      12  12  12      
14      12  12  12      
15      13  13  13      
16      13  13  13      
17      14  14  14      
18      14  14  14      

So here's the question.

I've got these values in sheet 1 that I'm looking to compare to sheet 2 and use conditional formatting to highlight certain things. I need excel to look at the census (for reference, 1-Oct census is 8 @ 7a) from sheet one and find it in sheet two. Then I need it to compare the number in RN's On Schedule to the number in RN Staffing Needs (RN Staffing Needs, in this case 6 @ 7a; RN's On Schedule, 8). When the RN's on Schedule value from Sheet 1 (F3 in the case of 1-Oct) is HIGHER than the RN Staffing Needs from Sheet 2 I need a conditional format to highlight that value green. When it is LOWER I need it to highlight that value yellow. When there is an exact match nothing needs to happen.

I've tried vlookups and index/matches with nested IF statements and IFERROR's and the like... this one's a little out of my scope of practice. Any help will be greatly appreciated!!


回答1:


I took the approach below, but you can probably consolidate it even more.

EDIT: I was able to consolidate it even more.

Apply this formula for conditional formatting for the Range(E3:E9) in Sheet1. Then make an additional rule, but change the formula to > and to fill green. Then you can use the same two formats against columns F and G and you just need to change the column references in your formula and the vlookup column indicator.

So, for column F, the formula would be =F3<vlookup(C3,Sheet2!$A:$D,3,0)

LEAVING OLD METHOD IN HERE FOR MORE DETAILED UNDERSTANDING

Sheet1

Enter the formula seen in the formula in cell I3 and drag through the end of the range (K9)

Conditional Formatting

Select the range from E3:G9 and apply the displayed formulas in the Conditional Formula Rules Manager.

For reference my sheet2 looks like this (based on your data displayed).



来源:https://stackoverflow.com/questions/33130885/multi-column-vlookup-conditional-formatting

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!