IF/AND between two dates Conditional Formatting - excel

I am trying to implement the following logic but my formulas are not encompassing all possibilities.
Am I able to accomplish the following using the approach outlined below?
C5 has a start date(yy/mm/dd), 2013-10-01.
D5 has an end date(yy/mm/dd),2013-10-23.
F3->CX2 has 7 cells merged with the monday's date in the cell.
Example: F3: 30-Sep-13, M3: 07-Oct-13, T3: 14-Oct-13.
F4->CX4 and below are the unmerged seven cells, therefore you have seven cells below each week cell.
My goal is to use Conditional Formatting when cell has value TRUE to fill the background colour of each individual cell between the start and the end date. However I am having trouble determining the correct formula. I have tried the following in F4 and across and below but none have proven to work for all scenario's:
F4=AND(C5=F3, D5>=F3) F5=AND(C5=(F3+1), D5>=(F3+1))...
only fills the cell for the start date not all the cells between the start and end date.
In short, I need to identify the start cell and fill it, continue filling all cells until the end date.
Should this be a macro with a while loop?
***I Believe I have solved my question with the following formula:
=IF(AND((F3)>=$C$5,(F3)<=$D$5),TRUE,FALSE), =IF(AND((F3+1)>=$C$5,(F3+1)<=$D$5),TRUE,FALSE), =IF(AND((F3+2)>=$C$5,(F3+2)<=$D$5),TRUE,FALSE)...Then after 7 cells it becomes: =IF(AND((M3+1)>=$C$5,(M3+1)<=$D$5),TRUE,FALSE), =IF(AND((M3+1)>=$C$5,(M3+1)<=$D$5),TRUE,FALSE)

Should this be a macro with a while loop?
It seems it does not have to be, though that depends upon my interpretation of your question, which seems odd if only because the conditions are not in the rows for which they trigger the formatting.
Select the applicable range starting in F4 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($F$3+COLUMN()-6>=$C5,$F$3+COLUMN()-6<=$D5)
Format..., select choice of formatting, OK, OK.

Here's a stepwise view on the problem as I see it:
Set up your data and include the actual date of your "weekly view" as part of the sheet:
Add conditional formatting to a single cell (say, Monday of Week 1) that applies to "a formula to determine which cells to format":
Copy-and-Paste-formats to the remainder of the cells:
The result should resemble:
Change the actual cell formatting to "" to remove the date from view:
The removes the capability to insert any content in the cells (but that wasn't part of the question). If you want to insert content and maintain colouring, you can base the conditional formatting on a similar-sized/shaped layout elsewhere in the sheet and format it accordingly. For example, the following layout provides this yet allows you to enter content in the conditionally formatted area:

Use the formula conditions. I put a start date in A1, and an end date in A2. Modify as needed per your requirements.
Then I will apply conditional formatting to values in range E1:E6. Again, modify as per your requirements.
Then simply use Highlight cells Rules > Between
Then, select your start/end values and press OK. Voila!

Related

How to refer to a current cell in a range when using conditional rules?

I have a column of cells range(A2:A10) containing a date for the first day of each week.
I want the cell color to change when the date is in the past.
When I select the cells I can apply a conditional rule but I can't figure out how to write the formula so it applies to each individual cell.
For example:
formula
=A2>TODAY()
works
However that rule will apply to the whole range returning the result for whether the date value in A2 is in the past.
I want the formula so that the value in A3 is the deciding factor for cell A3, A4 is the deciding factor for A4 etc..
The best way I can explain it would be using "this" in coding when writing the formula.
Select cells you want formatting in. For example A2:A10. When creating rule choose "Format only cells that contains" and in "Format only cells with:" choose "less than" and write =TODAY() formula:
Result:
Keep in mind that date format may be different due to settings.
Also tested your formula and it works fine:

Excel Conditional formatting Dates older then 60 days

I'm trying to use one Conditional formatting rule that does the following:
Ignore Blank Cells
Ignore Cells that do not have a date value
Highlight Dates that are going to expire in 30 days
So i have a list of dates:
07/25/2021
06/25/2021
05/25/2021
etc...
i used the custom formula under conditional formatting and used the following codes:
=CountIF(A:Z,today()-30)
i also used
=CountIF(A:Z,"<="&today()-30)
both codes highlight blank cells, i tried using the IF statements or IsBlank statements but i don't think i fully understand how those work. because i made a mess.
regardless of what i do, cells that are non-dates and blank cells are highlighted.
i even tried using the the conditional formatting rule, "Format only cells that contain" and i added the following:
Format Only cells with:
Cell value - less than or equal to - Today()-30
what do you guys think im doing wrong?
Assuming that your dates are in column B:
Select entire column B.
From menu start Format / Conditional formatting...
Add a new rule with the plus sign.
At Style select Classic.
After select Use a formula to determine which cells to format
Enter this expression: =AND($B1<>"",$B1<=TODAY()-30)
Select a desired formatting.
You can easily adjust this to row or any other range, or +30 days etc.
If you need more columns, select all of them, and assuming that the first column is A, the formula should be: =AND(A1<>"",A1<=TODAY()-30). See the screenshot below with formula and some example data:

Excel - Shading entire Column based on one value

i am trying to make a work calendar for myself. screenshot of the excel file
I have written a conditional formatting to color all saturdays and sundays with the following code
=OR(WEEKDAY(B2)=2,WEEKDAY(B2)=1)
how can i make the Entire column under that day be colored.
Thanks :)
If you are not going to be moving columns around (Friday will always be in whichever cell it is at present and days just continue in sequence to the right) it might be easier to select the entire range to be subject to formatting and HOME > Styles - Conditional Formatting, New Rule..., Use a formula to determine which cells to format and Format values where this formula is true::
=OR(MOD(COLUMN(),7)=3,MOD(COLUMN(),7)=4)
Format..., select your choice of Fill, OK, OK.
Adjust 3 and 4 to match whichever day you choose to start the sequence with wherever your selected range starts.
Given information you have withheld of what is where the above might be simplified.
In Conditional formatting | Use a formula...
=WEEKDAY(B$2,16)<3
extended from B2 down and across.
Looks like you need to add a relative cell reference on B2:
=OR(WEEKDAY(B$2)=2,WEEKDAY(B$2)=1)
Here's an article about using relative references in conditional formatting: https://www.ablebits.com/office-addins-blog/2014/08/07/relative-absolute-cell-references-excel-conditional-formatting/

Excel: How to highlight cells if the neighboring cell value differs by 2 or more?

I have several hundred rows of data in sets of two rows. Each row has ratings from 1-5. I need to highlight the cells when they differ by more than 1.
For example if one cell has a "4" and the cell below it is "3" or "5" that is ok. If one cell has a "4" but the cell below it has a "1,"2," or "5," both of those cells need to be highlighted.
I have looked into using conditional formating but this does not help because I can only enter rules asking to highlight < or >, not specific differences of 2 or more.
Background: The data is two sets of subjective ratings of videos of an autistic patient using psychological measures. If one rater differs from the other rater in scoring by more than "1," the data needs to be highlighted so the scoring for that measure can be discussed.
The picture is how the data should look like (not actual data file): http://imgur.com/a/Uym3G
Thank you!!
Assuming you only have two raters and no gaps in Column A after the first video and before the last, please select the range to be formatted starting in C4 and try this CF formula rule:
=OR(AND(ISODD(ROW()),ABS(C4-C3)>1),AND(ISEVEN(ROW()),ABS(C4-C5)>1))
For simplicity, and because I like to always have the ability to quickly change my conditional formatting, I like to use helper columns.
In this case, you can bring a helper column that you will hide afterwards.
Assuming your data starts in A2, and row 1 is your header rows. Assuming we are putting a helper column in B:
In B2 and B3: =ABS(A2-A3)
Drag all the way down
Put cursor in A1, conditional formatting based on a formula.
Formula =$B1>=2
Applies to $A:$A
Hide your helper column
Not sure what you base your statement about conditional formatting on, because what you describe is entirely possible with conditional formatting.
In conditional formatting you don't have to slavishly click the out of the box cell highlighting rules. You can easily roll your own by using a rule with a formula. Consider the following screenshot:
Select cells A2 to A10, create a new rule that uses a formula and enter this formula:
=OR(ABS(A1-A2)>1,ABS(A2-A3)>1)
Select a format and apply the rule to more rows/columns as desired.

Conditional formatting for a column based on the value of header

I have several columns where the data from rows 7 onwards changes depending on the selection made from a dropdown menu in row 6. Most of these options will result in textual or number based values appearing, but two of them would need to be formatted as currency.
Essentially what I want is a conditional formatting formula that says; if row six in any column has a value of “Implied Unit Rate” or “Annual budget”, format rows 7 and onwards in that column as currency.
I can get this to work by creating two separate conditional formatting formulas and applying them both to the whole area, but it seems like there should be a way to do it in a single formula.
My current formulas, applied as two separate rules:
=INDIRECT(ADDRESS(6,COLUMN(),1))="Annual Budget"
=INDIRECT(ADDRESS(6,COLUMN(),1))="Implied Unit Rate"
How I think it should work when applied as one rule:
=OR(INDIRECT(ADDRESS(6,COLUMN(),1))="Annual Budget",
INDIRECT(ADDRESS(6,COLUMN(),1))="Implied Unit Rate")
When I enter the combined formula in a regular cell within the worksheet, it does return true as expected, but does nothing when I apply it as a conditional formatting rule. Any ideas? Thanks in advance!
Now I may be mis interpreting what Scott is saying, so I am going to say this in my own words.
Your condition check on the cell address in question is a little "verbose". In order to apply your conditional formatting, select the range you want to apply your condition formatting to first. Lets arbitrarily say select range A7 to D42. After selecting the appropriate range, ensure cell A7 is the active cell of the selected range. This usually means there is a border around A7 to D42 and all cells but A7 have been slightly greyed to indicate that they have been selected, and A7 will have a brighter background to indicate that it is the active cell. With all that still in effect, select your conditional formatting.
In conditional formatting choose formula as the option (last one at the bottom) to control how your formatting will be applied. In the region where you can enter your formula, enter the following:
=OR(A$6="Annual Budget", A$6="Implied Unit Rate")
The $ will keep the row and column reference from changing as it is applied to each cell in the range. It will always be checking row 6 of what ever column the cell is in. The column A reference is relative to the active cell.

Resources