I am trying to conditionally format a range of cells based on the value of the right two digits. I'm using the following formula and it isn't working:
=VALUE(RIGHT($N2,2)) > 80
I'm trying to avoid splitting the column into two separate columns (it's a blood pressure reading, the figures belong together).
Your formula evaluates to TRUE and FALSE okay. When you say it isn't working I assume it's not doing anything at all, rather than giving wrong results. Have you remembered to set the format, as well as entering the condition!? Remember it will only format if it evaluates to TRUE... If these are correct, have you entered the formula as the condition and used the 'Use formula to determine which cells to format...Format values where this formula is true' rule type?
Related
I've read this forum for many Excel-related issues over the past 3-4 years, always finding answers when needed... but this time, I'm stumped.
I'm trying to use Conditional Formatting based on a formula to highlight values that are out out of range based on a cell that is a defined distance away. Specifically, the cell I will be attempting to format will be 8 cells to the right of the reference cell. (e.g., comparing R13 to J13, where J13 is the reference value). So the "Lower Spec Limit" is automatically generated from column J to Q, and the user inputs results in columns R to Y.
I would like to accomplish this without having 8 formulas, but so far I have been unable to figure out the right combination of AND/OR statements that will allow me to apply a single formula from row R to Y, where R>J, S>K, T>L, etc. are the conditions to be met.
In a nutshell, the formula I was using was basically:
=OR($R13>$J13,$S13>$K13,$T13>$L13)
Within the Conditional Formatting line. Of course, I then realized that this would format the entire affected range when any condition was met. I also tried to consider whether there was even data in the cell yet, but that got to be a messy way to highlight the entire range again anyway.
From other entries on this site, I've found that I need to:
Avoid INDIRECT references (can be unstable)
Potentially use OFFSET (although I'm unfamiliar within Excel formulas, only used in VBA in the past)
There will be other users for this spreadsheet, so that will have to be a condition.
Is this a feasible task, or would I be better off to have the 8 formulas (which will be 16 if I highlight based on "pass" and "fail" criteria)?
Thank you for your help!
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.
In Excel I'm trying to compute a value which depends on other range value. I have a very strange problem: the same formula with different value doesn't work for some case.
This formula works:
ROUNDUP(AVERAGE(IF(RangeName1=1;RangeName2));2)*100&" %."
This one doesn't:
ROUNDUP(AVERAGE(IF(RangeName1=2;RangeName2));2)*100&" %."
I check and my RangeName1 does contain these values: 1 and 2 (order like this).
Does anybody has an idea why the second formula doesn't work?
When I try your formula's both work fine.
Can you tell us what you are trying to achieve?
If you want to display percentage in a cell you could also use cell formatting, this way your cell will only contain the actual number displayed in a certain way instead. see http://www.excel-easy.com/basics/format-cells.html for reference.
I am trying to get a cell to highlight, given 2 criteria. The cell must be blank, and today's date must be after a predetermined date that is listed in another cell(R8C3). I'm also using R1C1 notation, but understand A1 notation as well.
The part I don't understand is that each criteria works independently, but when I use the AND function it no longer works. The relative references are used since this formatting will span multiple columns.
=ISBLANK(RC) evaluates to true and highlights correctly.
=TODAY()>=INDIRECT(ADDRESS(ROW(R8C3),COLUMN(RC))) evaluates to true and highlights appropriately.
=AND(ISBLANK(RC),TODAY()>=INDIRECT(ADDRESS(ROW(R8C3),COLUMN(RC)))) Does not highlight.
A slightly modified version pasted in a cell ( to check that the formula works) evaluates appropriately to TRUE or FALSE.
=AND(ISBLANK(RC3),TODAY()>=INDIRECT(ADDRESS(ROW(R8C3),COLUMN(RC3))))
I'm using Excel 2010 (version 14) on a Windows 7 device.
Try this:
=(J$1>K$1)*(ISBLANK(A1))
where J1 has the current date and K1 the threshold date.
The indirect statement seems unnecessarily convoluted... why not just use a mixed reference?
=AND(ISBLANK(RC), TODAY()>=R8C)
I have a three page work book. Pages 2 and 3 hold similar data but from different time periods (Cases Current, Cases Historic). Takes together the information from Cases Current and collates certain information using COUNTIF.
I have been trying to get a conditional format to change the text colour if the COUNTIF from Cases Current is higher or lower than a COUNTIF on the same data in the historic page. E.g.:
Cell C3 has the following formula :
'=COUNTIFS('Cases '!$D:$D,C$2,'Cases '!$C:$C,$A3) and displays the figure 7.
I have used a IF formula in a regular cell and this following does work. (In this example the COUNTIF returns 10.)
IF(C3<COUNTIFS(Compare!$D:$D,C2,Compare!$C:$C,$A3),"Lower","Higher")
I have used the same formula in Conditional Formatting but it triggers no change in font colour. I have stripped the two end conditions off the end of the IF statement as the conditional formatting is triggered on a TRUE return.
=IF(C3<COUNTIFS(Compare!$D:$D,C2,Compare!$C:$C,$A3)
This formula is incorrect for what you're attempting:
=IF(C3<COUNTIFS(Compare!$D:$D,C2,Compare!$C:$C,$A3)
It is actually an incomplete IF statement - try to copy it into a cell, and you will see that you don't have an argument for IF's "TRUE" state (which is required). Instead, you don't need an IF statement at all, just:
=C3<COUNTIFS(Compare!$D:$D,C2,Compare!$C:$C,$A3)
So this will check the value of cell C3, then check the value of the COUNTIFS function, and then check that C3 < COUNTIFS. If it is, it's a true statement, resulting in TRUE. Otherwise, it returns FALSE.