Excel 3 value IF statement using date ranges - excel

I am trying to create a conditional formatting for a range of dates. I want anything longer than 30 days away to format green, anything within 8-30 days to be yellow and anything less than 8 days to be red.
I have tried the following formula without any luck:
=IF(H56<=Today()+7,"1",IF(AND(H56<Today()+30,H56>=Today()+8,"2","")))
Any help would be greatly appreciated. Thanks.

OP has indicated that:
=IF(H56<TODAY()+8,1,IF(AND(H56<TODAY()+30,H56>TODAY()+7),2,3))
met his requirements.
This is a formula for use in connection with CF but not itself the formula for a CF rule. The formula would be applied to a spreadsheet in a 'normal' way - to return 1, 2 or 3 - and then those values (only two are really necessary) applied in CF with a rule such as Format only cells that contain (ie not applying Use a formula to determine which cells to format - though that is a viable alternative where two short formulae could be applied instead of the formula above in the spreadsheet).

Related

conditional formatting - if and statement

I am working on an if/and statement in conditional formatting.
I have 2 sheets. --- YTD Summary and Parameters
I want to conditional format the following 'YTD Summary'! I11:I31
These are set up as Percentages. The Parameters page has cell B2 with one of the following variables depending on what month it is (Jan, Feb, Mar, Apr, etc.)
the formulas I have tried are as follows
AND(Parameters!$B$2="Oct,'YTD Summary'!$I$11<(3/12-.05))
and(Parameters!B2="Oct",'YTD Summary'!I11<3/12-.05)
Conditional formatting takes the formula, but doesn't turn any of the percentages red within the specified range (I11:I31). Yes, I have formatted it for red text. Any help would be much appreciated. I have spent way to much time on this. thank you, Matt
=AND(Parameters!B$2="Oct",I11<0.2)
This worked for me. If the B$2 reference needs to move downward with the values in I, then remove the $ before 2.
Thanks!

How to set the background of three cells based off of the value in one other cell, relatively?

I'm trying to make a formula that will color code three cells that are directly above/below each other. The color coding depends on the sum of three other cells that are directly above/below each other, and directly across from the cells to be colored.
This part is easy. The rule is:
Forumula: =SUM(H5:H7)>30
And it applies to:
$E$5:$E$7
However, the issue is that when I copy the cells that are being colored (E's) to three more cells below them for the next batch, the relative formula does not work as expected. It applies the formula on H6:H8 (+1) instead of H8:H10 (+3).
Is there a way to get the relativeformula to work as expected? I hope this was clear enough. I know it's hard to visual a spreadsheet, but ultimately I need the relative forumla to add +3 instead of +1 when it is copied.
Problem:
If I correctly understand, what you are trying to achieve is to have the range E5:E7 formatted strictly based upon H5:H7, then the next three-cell range - E8:E10 - based upon H8:H10 and so on. You can do this by implementing the below solution:
Solution:
Step 1: Setup Columns as Below
Step 2: Implement Conditional Formatting as Below
Explanation:
I have recreated your issue and I see your problem; it was not that obvious until I played around with changing values of different cells in Column H.
Apparently, this has to do with how Excel interprets your instructions (formula) supplied under conditional formatting. To understand this let's first focus on the behavior of cells E5, E6 and E7 as a function of values in Column H.
With the formula =SUM(H5:H7)>30 did you notice that:
E5 format depends upon =SUM(H5:H7),
E6 format depends upon =SUM(H6:H8), and
E7 format depends upon =SUM(H7:H9) and
when you copy the range E5:E7 three cells down into E8:E10, the expected behavior is:
E8 format depends upon =SUM(H8:H10),
E9 format depends upon =SUM(H9:H11), and
E10 format depends upon =SUM(H10:H12)
And this is exactly how the range E8:E10 will behave once the above solution is applied.
A partial answer to your question has to do with your relative formula - =SUM(H5:H7) - under conditional formatting. Using this formula causes $E$5 to use =SUM(H5:H7) to determine its formatting, $E$6 to use =SUM(H6:H8) to determine its formatting, and so on. This ultimately leads to issues with the conditional formatting even before you begin copying the cells down.
EDIT: (piggy-backing off #Bharat Anand's answer)
#Bharat Anand's answer appears to be the best way to accomplish this question.
#Thisisstackoverflow requested clarification (under the accepted answer) and I'm hoping my screenshot below will help.
I set my worksheet up in what I believe is the exact same manner as #Bharat Anand, and it seems that the column letters may have been off. Setting mine up like this made it work correctly.
EDIT: (clarification for future visitors)
I really liked #Bharat Anand's solution, so I wanted to explain how it works (using the images/formulas in the solution as reference):
The calculation in Column I is setup to return a number that will only appear three times, in succession, in Column I; in this way it kind of behaves like a unique identifier, allowing other formulas to reference these values for calculation purposes.
Three times is key for the original poster because they were looking for a range of three cells to be formatted based on a sum of three cells. For example, the formula in Column I can be modified to
=ROUNDDOWN((ROW()-b)/a,0)
where:
a is your desired number of cells to format/sum, and
b is equal to a - 1.
Using the formula in J5 as an example, this SUMIF formula uses I3:I7, which includes two (or b, as setup in my explanation above) rows above and two (b) rows below to decide if I5 equals any of the values found in I3:I7. It's important to include the two rows above and two rows below so that the range overlaps the same three cells to meet the requested requirements.
When I5 finds a match, the formula looks to Column H to sum those rows in H3:H7 where I3:I7 equals I5. In this example, J5, J6, and J7 will each equal 32.
Using the simple conditional formatting formula that was setup, we know that cells in Column E should be highlighted when the corresponding row in Column H is greater than 30. According to the original question, this should be done in ranges that are three (a) rows tall. We already handled for that, so all that was left was to make sure the conditional formatting spanned the data area in Column E.
I'm hoping I don't confuse and/offend anyone with this explanation, but it's how I understand it. I like the proposed solution and explaining it to myself again helps me solidify how it works.

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 Excel 2010

I have a list of dates in a column starting with c8 thru C100. I applied the following conditional format and it will no work: =TODAY()-C8>30. I tried both the second and the last rule changing the color to red. Using the last rule all cells turn red except dates that = false such as dates less than 30 days.. I would not want to change the color of blank cells. Any suggestions will be appreciated.
I'm not clear what you are trying to do, using that formula on its own will turn the dates red if they are more than 30 days in the past, is that what you want? If you have other rules applied first they will take precedence.
If you don't want to format blank cells change to this:
=AND(C8<>"",TODAY()-C8>30)
This should do it:
=AND( NOT(ISBLANK(C8)), TODAY()-C8 > 30)

Formatting Selected Columns Depending Cell Value Is Odd Or Even

I have a sheet with several columns. Column A consists of numbers. Depending if the cell value in column A is even (or odd) I want to highlight several cells in that row, but not the entire row.
So far using conditionally formatting I have been able to add a formatting rule for each column I want to have highlighted. So for example if I want columns A, B and E highlighted I use three rules:
Formula: =ISEVEN(A1) - Highlight Format - Sheet!$A$1:$A100
Formula: =ISEVEN(A1) - Highlight Format - Sheet!$B$1:$B100
Formula: =ISEVEN(A1) - Highlight Format - Sheet!$E$1:$E100
...and etc for all additional columns.
But this is very cumbersome, I don't know how to make a rule to cover it all in once or even if it is possible. I'm guessing VBA might be the solution, but I'm kinda a rookie there.
Any clues on how to attack this?
You should just fix your reference column in the formula for that (A becomes $A in this case). The ranges it applies for then can be all put in the same rule as well:
Formula: =ISEVEN($A1) - Highlight Format - Sheet!$A$1:$B100;Sheet!$E$1:$E100
So no VBA required!
:) You do not need to sweat so much at all. I am not sure what your Highlight Format for. You can add the even, odd into the conditional formatting window/wizard text boxes and then choose the formatting colour accordingly.
Try this out:
For even:
=MOD(A1,2)=0
For odd:
=MOD(A1,2)>0
Check the following article for better help on Excel conditional formatting
Another article for 10 cools way to use Excel conditional formatting

Resources