How to highlight cells that have a specific formula.
E.g cells that have a formula of "vlookup".
I knew search/replace can always look into formulas. But how to look into formula for conditional formatting?
Using conditional formatting, based on this kind of formula:
=FIND("VLOOKUP";FORMULATEXT(...))
Keep in mind that find() seems to be case sensitive.
More elaborated: imagine you have a formula with VLOOKUP() in cell B2. On the cell you want to highlight, you can use conditional formatting (Home ribbon, Conditional formatting, Highlighting cell rules, More rules, "Use a formula"), and as a formula, you use the following:
=IFERROR(FIND("VLOOKUP";FORMULATEXT(B2));FALSE)>0
Explanation:
FIND() searches for the word "VLOOKUP" in cell B2 (mind the uppercase).
FORMULATEXT() converts the formula in normal text, and can be used as input for FIND().
In case the word "VLOOKUP" is not found, an error is shown.
The IFERROR() function deals with the error, showing FALSE as a result.
The "greater than" check makes sure that the formula results in TRUE, enabling the formula for the conditional formatting.
In the below example we use:
"=VLOOKUP" in column B to get the value of Column A from the range in H3:I3.
"=FORMULATEXT" in Column C to get the value of Column B.
"=IF((IFERROR(FIND("VLOOKUP",C2,1),0))>0,"Appears","Not Appears")" in Column E to check if words "VLOOKUP" appears in Column C.
Images:
Edited from #Dominique suggestions and it seems working.
'=IF(FIND("VLOOKUP",FORMULATEXT(A1)),TRUE)'
Related
What I am trying to achieve is if a cell in column AB equals "Yes" and a cell in column AC is blank, then a certain range of cells will be formatted. Currently the rule is not formatting cells that it should. I am basing this code on another formatting rule I am using that works properly, but does not use AND().
=AND(INDIRECT("ab"&ROW())="Yes", INDIRECT("ac"&ROW())="")
I am sure this is an obvious syntax mistake, but I am still very new to Excel and can't figure out why this isn't working.
Try This:
=AND($AB1="YES",$AC1="")
Use the format painter to drag the formula around.
As Jeeped said, change the 1 in $AB1 and $AC1 to your first row.
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.
Here is some demo data:
You can see the formula used in Column B returns TRUE for any consecutive duplicates, but when used as a CF condition on $A$1:$A$14 it returns different results?
Here is the CF setup:
So the condition shall be true if either the predecessor or the successor is the same value.
Within conditional formatting you can think about the row numbers as circular. So the predecessor of A1 is A1048576 and also the successor of A1048576 is A1.
The same is with the column numbers. After XFD follows A.
So your formula for the conditional formatting is:
=OR(A1048576=A1,A1=A2)
or
=AND(A1<>"",OR(A1048576=A1,A1=A2))
for excluding empty cells.
As sheet formula this will not work. There
=OR(IFERROR(INDIRECT("A"&ROW(A1)-1)=A1,FALSE),A1=A2)
is need.
This may also help you. It will work for whole column also.
=IF(A1="","",OR(A1=A2,A1=IFERROR(OFFSET(A1,-1,0),"")))
I'm currently using "Format only cells that contain" rule to highlight websites with suspect TLDs, in Excel 2010 and that works; but I have to make a new rule for every match value. Cumbersome to maintain.
Sample Data
Websites B:B
rcdesign.ru
htw.pl
opx.pl
TLDs A:A
.pl
.ru
I have another workbook that CF based on cell value matches in another column, but it's formula uses exact matches.
=ISNUMBER(MATCH(B1,TLDs!C:C,0))
Because my new sheet has partial matches, the suggested formula on another forum switches the array, and the look up value, but their formula spits an error.
Suggested Formula from another forum (gives error)
=INDEX(A1:A4, MATCH(TRUE, ISNUMBER(FIND(A1:A4, B1)), 0) )
My edit for Conditional Formatting.
=ISNUMBER(FIND(A1:A4, B1))
(I want to use this formula to activate conditional formatting, so INDEX() isn't needed.)
If functional, the cells in B:B column will format conditionally. What did I do wrong? (I did use Ctrl+Shift+Enter to make it an array formula in my test cell C1)
I'm sorry my original question was so vaguely worded as #BruceWayne pointed out.
I found an incredibly convoluted solution.
=NOT(ISNA(INDEX(A$1:A$8,MATCH(TRUE,ISNUMBER(FIND(A$1:A$8,B1)),0))))
This formula works as criteria for conditional formatting.
The only thing I haven't figured out yet is how to make A$1:A$8 into A:A; because any empty cells in the array cause false positives.
I am trying to use conditional formatting to highlight which of the cells in a row are today's date. I am using the formula:
=G2=(TODAY()) and the range is Sheet1!$G$2:$G$10.
However only the first cell in a column is highlighted even when the same date is listed below.
On a very similar formatting formula (=E2="High" on the range E2:E10) the formula seems to work a treat! I can't work out why there is a difference.
Thanks,
Alex
Please try:
=G2=TODAY()
(but only because one set of parentheses is not required!) and for Applies to:
=$G$2:$G$10
The Applies to range has to be in the same sheet as is G2 in your formula.
I suspect if you go back to the Conditional Formatting Rules Manager you will see that what you entered was automatially removed (substituted by =$G$2, hence the one cell that 'works').