Copying conditional formatting with VLOOKUP across columns - excel

I am formatting cell D25 using the following conditional formatting formula:
=(VLOOKUP($C25;$C$6:$L$18;2)+D25)>32
When applying the formula to the adjacent column I get formula updates to
=(VLOOKUP($C25;$C$6:$L$18;**2**)+E25)>32
Using the Copy and Paste Format function works mostly i.e. references in the formula are updated as I would expect.
The only (essential) thing that doesn't update is the INDEX value in the VLOOKUP formula. I would expect this value to increase by 1 when copying the format to the next column - it doesn't.
Is there any way to go around this issue with VLOOKUP? Is there a better suited formula to achieve the same result?
Any help will be greatly appreciated!!

This value does not increase automatically, and it is good. This formula was designed to be used on Tables, so consistency is a point here.
For conditional formatting, you may want to use $ to lock some references. For example, let we have the simple sheet as below:
First, select the range in the CORRECT order. This is important. the first cell you select will be reference for offsets of the conditional formatting. For this example, let's do it like this:
Now, let's go for the conditional formatting itself! Conditional Formatting > New Rule... > Use a formula to determine which cells to format. And let's put this formula:
=if($A1<=2;TRUE;FALSE)
Click OK and...
There we go! We just formatted the lines in witch An is equal or less than 2! Please note that we only had to lock the COLUMN of the reference. So, logically, to format the columns we would have locked the ROW.
Hope it helps!
EDIT:
If you REALLY want to use VLOOKUP, which I DO NOT recommend, you can just use the formula:
=(VLOOKUP($C25;$C$6:D$18;COLUMNS($C$6:D$18))+E25)>32
To change the index dinamically.

Related

change cell color with conditional format

I wanna ask about Ms. excel. maybe it will look so basic for someone who always work with excel. so thank you for anyone who help me with this.
I have sheet1 and sheet2. so i want to make cell in column A sheet 1, which have same data exist in column A sheet2 to change color automatically.
I don't know how to make it work so I made column helper in column c sheet1 with this formula
=NOT(ISERROR(MATCH(a2;sheet2!$A$2:$A$1000;)))
and get true if the data exist in sheet2. and then I drag that formula so all column c have this formula.
I thinking using conditional formatting, so I block column A in sheet 1, and make conditional formatting with formula
=C:C= "TRUE"
but this not work. i really a newbie and only study by myself from internet, but i dunno how to search to solve this problem.
any help or advice for this problem?
thank you so much before
You can put the formula that returns TRUE or FALSE directly into the conditional formatting rule.
You should define it on cell A2 first, then change the 'Applies to' range to be all the rows you want to test. If you can, I recommend you try to avoid using references like C:C.
So, supposing you want to test the data in cells A2:A10 on sheet1, then your rule would look something like this:
Note that my locale uses comma as parameter separator and not semi-colon, so you should adjust accordingly.
Try the following formula in CF rule.
=COUNTIF(Sheet2!$A:$A,"*"&$A1&"*")>0

Excel conditional formatting row if cell starts with

I'm trying to format a row based off a cell within it.
My table runs from A6 to K207 and I want to highlight the row in bold if the cell in B6 starts with SA.
I tested my formula
=IF(LEFT(TRIM(B26),2)="SA","YES","NO")
in another cell and that works ok - but I can't get the formatting to work for some reason...
I removed the yes/no and placed into a conditional formatting rule applying to my whole table and it doesn't work. Even if I apply it to just a row it doesn't work.
Am I using if statements within conditional formatting right? I've looked on Google and here and have found similar issues but not the same one, they've all used set values/ranges but not a 'starts with' condition.
The conditional formatting is an IF statement by default, and formats depending on whether the formula is TRUE or FALSE therefore an additional IF statement is not needed:
=LEFT($A6,2)="SA"
This will do the trick, apply this to the entire range as needed.
It will test whether all cells in column a start with "SA" and highlight that cell. If it is applied to a range including more columns, the $ sign fixes the column as A so tests that cell and highlights every cell based on that, effectively highlighting the entire row.
You can also use an OR statement to pass multiple arguments like so:
=OR(LEFT($A6,2)="SA",LEFT($A6,2)="BO")
Welcome to SO. When doing conditional formating (CF) in a formula, you need to apply references.
Switch between relative, absolute, and mixed references
Right now your formula is =IF(LEFT(TRIM(B26),2)="SA","YES","NO"). You are using relative references, so the CF rule will check according to their position. In A6 it will check the value of A6, and I guess you would like the rule to check the value always in column B.
So the first fix you need in yor formula will be (it needs more, hold on)
=IF(LEFT(TRIM($B26),2)="SA","YES","NO")
Now, it will check always the value in column B. But we need to fix something else. To make the CF based on a formula, you need to formulate something that returns a boolean value, True or False. Your values Yes or NO are strings (text), not boolean, so they don't work.
So try this formula and let's see if it works:
=IF(LEFT(TRIM($B26),2)="SA",TRUE,FALSE)
An IF Functions allows you to make a question where the answer must be yes/no (true/false) and, depending of the answer, Excel will do an option or another.
With CF rule based on a formula, you just need the question itself, you don't need to choose an option. So the short version of this formula, as #Plutian states in his answer, is just doing:
=LEFT(TRIM($B26),2)="SA"
Try to adapt this to your needs.

Error Checking in Excel

I've got a workbook, that i use for fleet allocations, but i'm not sure how to do error checking in excel, and was wondering if anyone could point me in the right direction. When i allocate the vehicles to a duty, it uses vlookup to bring the driver name into the sheet. but what im unsure of how to do is, i have 54 duties, and it would be easy to miss one, so is there a way i can make it show me which duties are left to allocate ? please see screenshot...
Excel Worksheet Screenshot
For a layout as shown:
Select ColumnA, clear any existing CF from it and HOME > Styles - Conditional Formatting, New Rule..., Use a formula to determine which cells to format and Format values where this formula is true::
=AND(A1<>"",COUNTIF(C:E,A1)=0)
Format..., select formatting of choice (I chose the same fill as for the headers) OK, OK.
Well, had a look at your sheet... But I put this together as it is simple and you may be able to include it where you can...
Tha match() function looks for the duty in cell A2 and if it finds it in the list in column I then it returns its position number. If not found the iferror() returns "Not Allocated"...
The formula in cell B2 is:
IFERROR(MATCH(A2,J$2:J$10,0),"Not Allocated")

Excel conditional formating - conditional on sum of all previous cells and total sum

I have a question with regards to conditional formatting which I simply can't seem to solve.
The aim is to format the background color for the left-most cells that are blank up until a cell contains a value - and after this there should be no more formatting in this row. You can see an image of the result I'm hoping for beneath:
So far I've managed to create the conditional formatting of the blank rows, but sadly haven't managed to create the "single-cell" formatting (in yellow) conditional of the sum of all the first cells being = 0.
I've created a formula which actually succeeds in calculating the sum of the previous cells, but this formula includes INDIRECT() which it seems that conditional formatting doesn't allow. At least I'm getting an error starting with the follow (translating the error from Danish to English might not be intuitive):
You cannot use reference operators such as.....
The formula I'm trying is the following:
=AND(SUM(A2:INDIRECT(IF(COLUMN(A2)>=27;CHAR((64-26)+COLUMN(A2))&CHAR((64-26)+COLUMN(A2))&ROW(A2);CHAR((64)+COLUMN(A2))&ROW(A2))))>0;$K2>0)
Where $K2 is the sum of the row.
Is there a way to SUM a range of cells by doing something similar to this:
=SUM(B2:CHAR((64)+COLUMN())&ROW();"")) to dynamically SUM the range from B2 to the current cell? The problem in this case is whether the part CHAR((64)+COLUMN())&ROW();"") can be converted into a legible cell such as B4 to make it work inside the =SUM() formula?
Sadly the =ADDRESS() formula cannot be used (as far as I know) as this will trigger the same error in conditional formatting as well.
For now I would like this to work with the regular Excel conditional formatting, but if anyone have a simple VBA this would also have interest - however, I would by far prefer the regular solution.
The question:
Is there a way to create a formula that doesn't trigger this error - maybe by refrasing the formula or doing something completely else?
It seems to me that this could be handled with a much simpler CFR formula like,
=and(not(sum($a2:a2)), $k2)
Am I missing something?

Conditional Formatting to reflect Countifs

I am using Excel2010 and I have the following Countifs statement, which works.
=COUNTIFS(Apr2014Fixed!$T:$T,"1",Apr2014Fixed!$Q:$Q,"*No*",Apr2014Fixed!$R:$R,"*Yes*")
I want to see which rows in my spreadsheet were counted, so that I can determine whether I've done everything right. I tried conditional formatting with the following formula, but I know I'm not using it properly.
=AND(COUNTIFS(Apr2014Fixed!$T:$T,"1",Apr2014Fixed!$Q:$Q,"*No*",Apr2014Fixed!$R:$R,"*Yes*")=3)
I don't understand what value I am looking to highlight. I thought =3 because I want all three conditions to be true for a case to be counted, but this didn't highlight anything. When I tried >3, it highlighted the entire spreadsheet.
Obviously, I have no idea how this works? Can anyone help, please?
To format rows across multiple columns, select the desired columns (in the screenshot I selected Q to T) and create a new conditional format with the formula
=AND($T1=1,ISNUMBER(FIND("No",$Q1)),ISNUMBER(FIND("Yes",$R1)))

Resources