Conditional Formatting of multiple lines based on variable?

bwinchell

New Member
Joined
Jul 19, 2016
Messages
15
Hello,
I am a newbie to doing anything beyond the basics in Excel so you might have to very specific in explanations. unfortunately I do not know VB (some Javascript & bash) and afraid what I am looking for will require it.
Thanks

Environment: Excel 2013

Current Workbook layout:
ABCDEFG
1SystemVoltageRUBTU110v208vKG
2computer1208219452.71.217
3
4computer220817801.4.77
5computer3208310003.01.511
6
7

<tbody>
</tbody>


Explanation of columns:
A = a system name based on a dynamic list created from a tab called "master" > tbl_master
B = the parameter used to search against the object in the tbl_master
C - G = are filled via an INDEX formula against the tbl_master using the system name as the key


Final Result (what I am trying to accomplish [---- represents highlight or something similar]):
ABCDEFG
1SystemVoltageRUBTU110v208vKG
2computer1208219452.71.217
3----------------------------
4computer220817801.4.77
5computer3208310003.01.511
6----------------------------
7----------------------------

<tbody>
</tbody>


Explanation of "----" in rows 3, 6,7:
  • column C represents the amount of "U" in a computer rack
    • Using the value in C, I would like to automatically fill in the rows with conditional format or symbols (something to indicate the blank space is actually occupied)
    • E.g.
      • if C = 1, no fill necessary
      • if C = 2, fill in the row below with yellow
      • if C = 3, fill in the next 2 rows below
      • etc.....

Any assistance is appreciated.
Thanks
B
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
I would start by putting an expression in column C. For C6 it would be if C4 is 3 or C5 is 2 then ---- else ' '. Then fill the other columns based on C.

This will work as you add rows (and thus overwrite the formulae) but not if you move a computer out of a position. You would need to copy the formula back in and I'm not sure you gain much over manual editing.
 
Upvote 0
Hi Stacko,
I would not be able to put a formula in column 'C' as it already has an Index formula to initially populate C-G
Thanks
B
 
Upvote 0
Welcome to the MrExcel board!

I would not be able to put a formula in column 'C' as it already has an Index formula ..
So, in your sample above, what exactly shows in cells C3, C6 and C7 on your sheet?
 
Last edited:
Upvote 0
Here is the actual formula that resides in C-G

Code:
=INDEX(MASTER_tbl,MATCH('M3-C1'!A2,MASTER_tbl[Name],0),13)

So it basically finds the key in the MASTER_tbl and then finds the appropriate referenced column for a value.

C3, C6, C7 (in the example above):
Have no entry as A is empty. Once you pick an entry in A from the dynamic list created by the key in MASTER_tbl, then those columns will populate.

What I am trying to accomplish is:
1. Once you pick an item in A2, items in C-G are populated via INDEX
a. This works
2. If C2 != blank or C2 >1
a. Colour fill the next X rows
i. X = C2-1

Item 2 is where I am stuck.

Hopefully I explained this clearly in my broken "Excel".
Thanks
B
 
Upvote 0
Once you pick an entry in A from the dynamic list created by the key in MASTER_tbl, then those columns will populate.
How does that happen, say in row 3, given that you have said C3 is empty.

If C3 is empty but gets populated by a formula if A3 has a value entered, how does the formula then get into C3? Manually? Code? Something else?
 
Upvote 0
Code:
=INDEX(MASTER_tbl,MATCH('M3-C1'!A2,MASTER_tbl[Name],0),22)
=IF(B2=Varibles!A2,INDEX(MASTER_tbl,MATCH('M3-C1'!A2,MASTER_tbl[Name],0),20),0)
=IF(B2=Varibles!A3,INDEX(MASTER_tbl,MATCH('M3-C1'!A2,MASTER_tbl[Name],0),21),0)
=INDEX(MASTER_tbl,MATCH('M3-C1'!A2,MASTER_tbl[Name],0),15)

The formula above resides in every cell in columns C-G.

So if you do not pick an entry in column A, then the INDEX finds nothing (in reality it actually comes back with 0 or #N/A.... maybe this is what you were looking for).

Thanks
B
 
Upvote 0
Correct above:

I left out a formula.

Code:
=INDEX(MASTER_tbl,MATCH('M3-C1'!A2,MASTER_tbl[Name],0),13)
=INDEX(MASTER_tbl,MATCH('M3-C1'!A2,MASTER_tbl[Name],0),22)
=IF(B2=Varibles!A2,INDEX(MASTER_tbl,MATCH('M3-C1'!A2,MASTER_tbl[Name],0),20),0)
=IF(B2=Varibles!A3,INDEX(MASTER_tbl,MATCH('M3-C1'!A2,MASTER_tbl[Name],0),21),0)
=INDEX(MASTER_tbl,MATCH('M3-C1'!A2,MASTER_tbl[Name],0),15)

C = top
G= bottom
 
Upvote 0
I don't think the actual formula will be relevant to the problem. I was asking the questions to determine if those cells in column C were actually empty or not. You had initially said that they did contain formulas but then I was hesitant after you stated
C3, C6, C7 (in the example above):
Have no entry

We still may need a more substantial set of sample data, with color applied, but see if this is headed in the right direction.

Select A2:G??
Home ribbon tab -> Conditional Formatting -> New rule... -> Use a formula to determine which cells to format -> Format values where this formula is true -> Enter formula from below screen shot -> Format -> apply the format you want -> OK -> Ok

Excel Workbook
ABCDEFG
1SystemVoltageRUBTU110v208vKG
2computer1208219452.71.217
3
4computer220817801.40.77
5computer32083100031.511
6
7
8
94
102
11
12
131
141
153
16
17
18
Sheet1
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A21. / Formula is =AND(NOT(ISNUMBER($C2)),ROW()-LOOKUP(9.99E+307,$C$1:$C1,ROW($C$1:$C1))Abc
 
Last edited:
Upvote 0
That seems to have done the trick.

Let me do some double checking over the weekend to verify and I will upload the finished product if it all works out.
Thanks
B
 
Upvote 0

Forum statistics

Threads
1,215,454
Messages
6,124,933
Members
449,195
Latest member
Stevenciu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top