Excel Dynamic Conditional formatting - excel

I am sure this is really simple but cannot get it to work. I am trying to do some conditional formatting on a sheet that over time will have additional columns added to it. I want the formatting to be there before hand since the data is being added via VBA and the person using the spreadsheet are not Excel experts.
What I have is a column with numbers in. When a new column is entered I want to compare the value with the value in the previous column and then colour the cell accordingly. I can do this for a single cell with for example "=D2>C2".
I want to be able to write the rules in cell D2 comparing it with cell C2 and then have the rules apply across the area D2:DDD300. So for example cell N19 will compare itself to cell M19.
I thought I could use the "Applies to" box but that does not work. Any ideas on how I can achieve this?

Okay this now appears to be working. Not sure what I did differently but deleted all the rules and then set them up again. The only thing I did different was to initially do it for just the 1 cell, then expanded it out to the row when I knew it was working, then finally the whole area.
Sorry to have wasted peoples time

Your method should work. It does for me. Maybe this helps:

Related

Why does my Conditional Formatting fail when it works in Worksheet? Possible INDIRECT issue?

I am trying to do a comparison/Conditional Formatting between columns based on a drop-down choice. I have a formula that works fine in the spreadsheet, but does not seem to be working in my Conditional Formatting formula. Is INDIRECT causing my issue?
Formula is:
=IF(H1>100, IF((H1-INDIRECT(ADDRESS(ROW(H1), MATCH($H$4,$A$3:$I$3,0))))/((H1+INDIRECT(ADDRESS(ROW(H1), MATCH($H$4,$A$3:$I$3,0))))/2)>$J$2,TRUE,FALSE),FALSE)
Kind of hard to read, but the part that broke it is trying to grab my comparison cell using the following:
INDIRECT(ADDRESS(ROW(H1), MATCH($H$4,$A$3:$I$3,0)))
Where $H$4 is my drop-down value. So I am selecting the column that contains the data I want to compare to, then using address to select the current rows cell, then accessing it with INDIRECT.
If I replace the INDIRECT part with an actual cell, everything works as it should as well.
When I use the first formula, everything looks great if I input it into a cell on the worksheet, but I would rather not dirty it up if I don't have to. Is there a way to make this work?

Copy relative data validation rules

I'm sorry if I put this question in the wrong section, because it is not entirely focussed on programming. But I don't know where to put it else.
I have the following rule as data validation for a particular cell in Excel:
=INDIRECT($D$5)
I want to copy this data validation rule to other cells. However, when I copy/paste the cell, it literally pastes the value of the data validation instead of the relative data validation. So I want $D$5 to be $D$6, $D$7 etc. in other cells. I have tried Paste Special > Validation, but it didn't work. Maybe there is a script for this?
Thanks.
Thanks to #doug-glancy comment and to make sure there is an answer for this question, writing a formula as =INDIRECT(D5) does the job.
In my case I set the formula and by drag and drop copying the cell formulas of new cells will automatically get updated.

Apply Conditional Formatting to Cell on Left

I have a spreadsheet with 15,000 rows and 30 columns, and have applied a conditional formatting to column X to color it when it contains a certain text. This works as expected; however, I want to apply this same formatting to the cell immediately to the left (column W) as well. Is this possible?
Based upon what you say below, this is what I tried:
The formatting is not working. Is the lookup formula not correct?
Note: Since I never know how many rows I may have at any time, I am trying to apply the formatting to the entire column instead of a specified range of cells.
EDIT:
The $X1 trick works!
You are the BEST! Many thanks to all of you!
Of course!
Your conditional format range will look something like this:
Just change the (highlighted) range to $E$1:$F7 to apply the formatting to both columns. This doesn't affect your condition at all.
As Jeeped points out, any time you change the "Applies To", you should double check the Formula and make sure it didn't change. Using anchors ($) in your range helps greatly with this. Note how in my formula, I have =Left($F1,3)... The F is anchored. I'm pretty sure if that was just Left(F1,3), and I adjust the "Applies To" range to $E$1:$F$7, the formula would "update" itself to be =Left(E1,3)... which isn't what I wanted.

Conditional Formatting rows with shared Merged Cell

I've got a little helper spreadsheet that I use, and there are some Merged Cells.
Rather than get rid of these, which I know can cause headaches, I was looking for an idea on fixing an issue.
I have a few rows that share a merged cell. When this merged cell is not empty, I want the rows to highlight. Currently, the formula (applied over A1:B4) is =$B1<>"" and then a fill. Works okay for the first row, but not the other three:
I was thinking I could add some more logic, but there's nothing really there for me. It's a pretty simple table. Unfortunately, there's not really a way to say (for rows 2:4), if row 1 is colored, then color this row...(Although I think I've seen clever uses of Named Ranges to do something like that, but I could be mistaken).
So, in A2, what's the conditional format formula "thinking"? Is it going to =$B2<>"", in which case ...what's it looking for as B2? If I select A2, and look at the conditional format rule applied to the current selection, it still shows =$B1<>"".
Thanks for any ideas/tips. It's not a huge deal, so I don't need a VBA solution - just maybe an idea or trick for using CF with merged cells.
Edit: For a more full explanation - the idea is that col. B will have an invoice number and if it's there, make the row a color. I will be repeating this "chart" a bunch, and have some non-grouped companies, who have their own lines. I just don't like the gap of color there in my group and was trying to get it to have a color when the first of the group does.
I usually try to base my CFR's on formulas.
    
After selecting all of column A and B I created a CF rule with the following.
=AND(LEN($A1), ISNUMBER(MATCH(1E+99, $B$1:$B1)))
The approximate MATCH function simply looks for the last number in the B column. I can see a missing invoice number in a cell like B7 would generate confusion but perhaps you can expand on this for conditions not demonstrated by your examples.
If you want to use "placeholder" instead of blank cells (when there is no invoice), you could try the following formula:
=(LOOKUP(2,1/($B$1:$B1<>""),$B$1:$B1)<>"x")*LEN(A1)
With sample data it looks like this:
When the cell is left blank (no placeholder), column A is highlighted, column B is not.

Checking cell value dynamically

What I'm doing is a simple map on one tab of an office space that has all the cubicals laid out. On this map, I have conditional formatting checking another table of listen computers for the last time they were updated/maintained. It works as it stands, but we are moving into a new building and the map (which is already done) has WAY more cubes than last time. So I'm trying to figure out a more efficient way to do this task.
Here is the code:
=AND(VLOOKUP("CCA C1",LOCATION,3,FALSE)<>"",VLOOKUP("CCA C1",LOCATION,3,FALSE)<TODAY()-80)
So as it sits, it works fine. But what I'm trying to do is change the "CCA C1" to simply read the contents of the cell it's formatting so I can just format an entire range of cells rather than doing it cell by cell. The "CCA C1" is in the location of the second sheet (it's a named range). So this checks that entire range for "CCA C1" and checks if the date a couple columns over in that row is within 80 days, if it's not it highlights the cell in the map in red reminding us we need to check the computer. But what I would like to do is simply put "CCA C1" in the cell in the map (which is already is labeled), and have this check for the value of the cell it's formatting and look for that value the same way it's looking now. Just without me having to put "CCA C1" in the formula, I'd like to say something like this:
=AND(VLOOKUP(CURRENT CELL VALUE,LOCATION,3,FALSE)<>"",VLOOKUP(CURRENT CELL VALUE,LOCATION,3,FALSE)<TODAY()-80)
Make sense? Anyone know of a way to do this? Otherwise I have to conditionally format each individual cell with the value manually rather than just format all the cells with the same formatting and have the formula check the contents of the cell for what to look for in the location range of the other sheet.
And to clarify, I know that I can put in the actual cell, such as E3, but then I still have to manually change the formula for each cell which defeats the purpose. I want to just say current cell or something like that. I have 3 conditional formats for each cell, I have around 100 cells to be formatted, so rather than having 300 formats I have to put in, I'd love to just do 3. Not sure if this is possible, that's why I'm asking :)
Just replace "CCA C1" with the address of the first cell in the range of cells with the conditional formatting. Assuming your conditional formatting starts in B2:
=AND(VLOOKUP(B2,LOCATION,3,FALSE)<>"",VLOOKUP("CCA C1",LOCATION,3,FALSE)<TODAY()-80)
EDIT: As I commented, I'm not sure I understand the issue, but if I do, you need to enter the range of cells with CF in the applies to range of the CF dialog, rather than copying and using Paste Special:
Note that this works with the merged cells.
You will need to adjust the applies to range as you add more computers, etc., but the same formula will work.

Resources