Conditional formatting of cells that contain formulae but no values - excel

I like to use conditional formatting to provide extra information in my spreadsheets, but I now find myself stuck.
In a spreadsheet of cargo items, I have a column (calculated; it contains a formula) for density. Previously, it just changed text colour, so empty cells didn't stand out. But now that I'm trying to really show up any anomalies with a bright background, I've found that it (or its sibling) highlights all the "empty" cells that don't have calculated values yet.
The formula I'm using is WHERE THE VALUE IS GREATER THAN 10 for the upper out-of-bounds area, and =AND($L2<3,NOT(ISBLANK($L2))) for the lower area. I've also tried using $L2>0 instead of the NOT clause.
The ideal would be changing the upper and lower density limits based on the material it's claimed to be in the description field (column B), but I'm not bothering with that until I get this working.
Is the formula I'm using right, or should I tweak it? Would I be better off just using GREATER THAN 0 and then formatting the right densities blue as =AND($L2<10, $L2>3)?

I think counter-intuitively it is the
WHERE THE VALUE IS GREATER THAN 10
formula that may be doing the damage.
You probably have a formula in column L on the lines of
IF (<cell in previous column is empty> , "" , <some calculation>)
and when the conditional formula compares the result to 10 it actually gives TRUE because a text string is considered to be greater than a number in this context.
I suggest trying two things:-
(1) Change the colour of the WHERE THE VALUE IS GREATER THAN 10 formatting rule to see if the 'empty' cells are highlighted in that colour.
(2) Instead of WHERE THE VALUE IS GREATER THAN 10, use a formula like
=AND(ISNUMBER(L2),L2>10)
this works for me.

Related

how do I compare each row of two different columns and highlight the highest value (not formula) in each row?

I have two columns to compare. All cell values come from the ROUNDUP function. =ROUNDUP(C6/D12,0) etc.
I want the larger, or equal, of the two in each row to be green and the smaller red. Using the formula, it does not work as expected. If I do the same with numbers typed, not the formula, it works. It appears the formatting applies to the formula and not the value.
That is the first half of the problem. I also want to autofill/paint the conditional formatting to numerous cells, but it always compares to the top left cell, rather than the two cells on the same row.
If I use the color scales formatting it works, but I do not want the scales, just red/green.
It seems hard to believe that what I want to do is not possible. Can someone please help me with this. Thanks in advance.
In conditional formatting, under 'use a formula to determine which cells to format', you need to enter
=A2=MAX($A2,$B2)
to highlight the larger cell and (as a separate rule)
=A2=MIN($A2,$B2)
to highlight the smaller cell.
Note that in the case where both cells have the same value, they will both be either coloured red or green depending on the precedence of the rules. If the 'green' rule comes first,
it will look like this:
Conditional formatting is almost its own little science within Excel. It may be more useful to find youtube tutorials on the topic than depend on a text explanation here. But the central theme is this.
You will use location locking (the dollar sign or F4) in front of the letters so that any cell to which the format is applied knows you specifically mean columns E and F, for instance.
Example: Assume your first row goes from A5 to M5, and the condition values are in E5 and F5.
I find it easiest to format one row with the rules I want, test them, and then use the format painter or copy -> paste format along with careful use of $ locking.
Drag over and select the entire row of cells A5:M5
Conditional Formatting -> New Rule -> Use a formula to determine which cells to format
In the formula field enter =$E5>$F5. Excel gets weird and often inserts double quotes. If you save the rule and go back in, it may say ="$E5>$F5" and if so delete the double quotes.
Click Format and create the cell format you want.
With A5:M5 still selected, add another rule and format for ="$E5<$F5"
The $ sign works the same way as it does in a formula. All of the columns get their format based on columns E and F, but all of the rows base their formula on the E and F values in that same row.

Conditional formatting of two rows in Excel through row comparison

Consider the following data:
I would like to compare each cell in row 1 to the adjacent cell below in row 2, using red for inequality and green for equality. A similar principle applies for rows 3 and 4. I.e., the output should be
The data I have in reality have more rows and columns than in this toy example, so the less manual work that has to be done, the better. The data I have are small enough that I would be fine pointing and clicking for results. I've tried using Conditional Formatting for this, but haven't been able to figure out its formulas.
I would prefer a non-VBA solution if possible.
I don't necessarily need the provided solution to be general, as long as it's clear to me how it can be generalized. I.e., it needs to be obvious how to adjust the solution when the data start at a different row or column, other than cell A1.
The following formula will format all pairs of nonequal cells:
=OFFSET(A1,1-2*MOD(ROW()+1,2),0)<>A1
Create a second rule with <> replaced with = to format the equal cells.
Fill all the cells red then use this rule to turn them Green
=AND(A1<>"",OR(AND(MOD(ROW(A1)-1,2)=0,A1=A2),AND(MOD(ROW(A1)-1,2)=1,A1=INDEX(A:A,ROW(A1)-1))))

Excel Conditional Formatting and Rounding Issues

I am trying to find a way to use excel formatting to show the color red when a specific cell is not equal to another cell. However, there are times when the value is off by two or three numbers due to how excel rounds(ex: 593=594, 593=592).Is there a way to use excel formatting or any other way to make it so if the value of the cell is very close to the targeted cell, it will not result in the cell being formatted to red. Anyway this the simple formula I am working with along with example:
=I3<>F3
EX:
**I** **F**
593 594
Essentially the F cell will be highlighted in red but because the difference is negligible,
I don't want to highlight red. At most, I would like to have a difference of more than 3, where the cell won't highlight red.
You should consider the absolute difference between the two numbers. If it is in a given range, which is acceptable, you may consider them equal. Thus, this is the formula that you need:
=ABS(I3-F3)>0,5 '0.5 if you are using "." as a decimal separator
It will consider 233.4 and 233.6 as similar values. MSDN ABS
In general, if you write =ABS(I3-F3)>0,5 in Excel it should evaluate to TRUE or FALSE. If it does not, probably the comma is the problem, thus change the comma with a dot - ..

Conditional Formatting with a formula, highlighting errors

I have a column (I) that is a sum of total hours worked for a month. I'm trying to apply a conditional formatting rule that will highlight cells that equal 0 but aren't blank.
The formula I'm using is:
AND(I2=0,NOT(ISBLANK(I2)))
It highlights most of the 0 values (but not all of them) and it is also highlighting some non-zero values.
I don't know if will help, but this is a sample of what I'm getting:
I had a simmilar problem a few months ago. Mark Fitzgerald pointed out the right direction to me. Times in Excel are all percentages of days. Computers calculate in binary so all those decimals have to be converted to binary before the math operation and the result has to be converted back to decimal.
But decimal places are limited to 15 in Ms Excel. You can check the whole answer here.
I think your issue is the Applies to range (though I am surprised that the Total label is not then coloured blue). It seems to me the formatting is correct but offset by one row. For simplicity, I suggest selecting the entire Total column and applying:
=AND(I1=0,NOT(ISBLANK(I1)))
Or select the range to format starting in the first cell below Total (ie Row2) and apply your formula.
Taking the 'simpler' approach, if you don't want the label formatted you might give it a rule of its own, with No Format Set chosen and make sure it has priority (eg at the top of the list with Stop If True checked).
#Dimitrios has a point (but it seems also a solution) if the values are being calculated.
=AND(I2=0,NOT(ISBLANK(I2)))
Enter the conditional formatting as a formula into the first cell. Click 'Ok'. Then copy the first cell and paste special as "formatting" to the remaining cells.
This will work as you desire.

Use formatted cell if the value is in certain bounds

I am having a grading scale and would like to map my grades to the grading scale.
I tried to use just VLOOKUP(), however, the formatting is not taken and also some bounds are breached.
Any recommendation, how to use the formatting in my resultCell?
You would use conditional formatting.
To get the result name to print, use this formula:
=INDEX($A$2:$A$6,MATCH($E2,$B$2:$B$6,1))
For the Number:
Reproduce these steps:
Change your table so the values aren't equal to each other, as in, the Perfect(Max) shouldn't be the same as the perfect-(Min).
Take the result cell, and go to Conditional Formatting.
Highlight Cell Rules > Between
Select the cells that contain the min and max for that particular color.
Select "with" Custom Format
Select the color you want for that result
Repeat for each color you want used.
For the "Perfect" Result:
Repeat the same as above, except use Highlight Cell Rules > Equal To Then select the appropriate values for each color, ie, "Perfect" for Dark Green, etc. Use the actual cell address.
You will want to leave the fourth parameter of the =VLOOKUP() formula as TRUE for an approximate match. This allows you to get "map/lookup" values in-between the ranges of numbers.
This should do the trick, just play with the cutoffs to get the behavior you desire:
Various adjustments that would normally be considered quite minor might make this question a lot easier to answer, but taking the details as they are (with Start assumed to be in C2, 3,4 assumed to be three and four tenths and the required output as shown in G3 and G4), in G3 and copied down to suit:
=IF(F3=0;"perfect";IFERROR(INDEX(B:B;MATCH(F3;C:C;0)-1);INDEX(B:B;MATCH(F3;C:C))))
Select ColumnG, HOME > Conditional Formatting – New Rule…, Format only cells that contain, Format only cells with::
Specific Text
containing
perfect
Format…, dark green fill, OK.
Repeat rules as below:
Where the order is important because “contains low” will find both low and low- so orange should be applied after red.
What might have made things easier is:
To have columns B and C switched over (ColumnD is not required) to allow use of VLOOKUP instead of INDEX/MATCH.
To change the break points (so that the START values are not the end of the previous range and part of that and hence the need to attempt an exact match before resorting to an inexact one).
To classify without relying on the - for differentiation (to avoid the ordering issue mentioned above).
To place perfect in B2, to avoid the equality issues mentioned in a comment (and I think not addressed in the accepted answer).

Resources