Tricky Conditional Formatting Involving Actual Values vs. Displayed Values - excel

I have read other threads that are similar to what I need, but none of them are working due to my displayed date issues. Is is possible in Excel 2013 to set a conditional formatting rule to highlight cells in column C & D based on the displayed information in column B instead of actual data?
In Column B I have dates entered in as mm/dd/yy number format, but displayed as Day of the week, Month, Date, Year (example: 02/03/14 displays as Monday, January 3, 2014). I want to highlight the cells next to it based on the displayed text, not the numbers behind it.
My goal is to highlight the cells in column C-H if the dates in column B of the same row show either Saturday or Sunday. My first thought was to truncate the first three letters from each cell in column C into empty column A (showing as Thu Fri, etc) and reference that in my conditional formatting formula, but the LEFT function wants to grab the numbers and not the words from column B.

You could use Weekday function for conditional formatting:
=OR(Weekday($B1)=1,Weekday($B1)=7)
where 1 corresponds to Sunday and 7 to Saturday

Related

Dependent expiration dates

I have a spreadsheet that records a timeline of information for different documents, specifically: when I send it, when I respond to it and when I need to finalise it.
In column J, I input the date I have sent the document given as a short date.
Column K, then automatically adds 15 days to J - giving me my response date.
=IF(J4<>"",SUM(J4+15),"")
Column L is my final date for when I've finished with the document.
What I'm struggling to create, is a conditional formatting formula for column K that reads the cells in column J - adds 15 days and highlights all the dates beyond the 15 days; that part is pretty simple. However, I would also like it to read the cells (in the same row) under column L - and if that cell is not blank/it has a date, then do not highlight column K. Meaning if I have finished with that document, I don't want it to run a formula to remind me to follow it up!
Below is a visual example:
So in the cell J3 reads the 27th November, add 15 days brings us to the 12th December which is before today's date (the 15th) and because there's nothing in L3 - I would like it to mark K3 as red.
Alternatively, in J4 is the 28th November, therefore it's the 13th December in K4 - however, because there's a date in L4 I do not want it to flag K4 in red.
Thank you, I appreciate the help!!
In order to highlight the values in column K if the date is passed and if column L contains a blank, you can use the following formula for your conditional formatting:
=AND(K3<TODAY(),ISBLANK(L3))
If you already have a formula for your conditional formatting, simply replace it. If not, you add the formula the following way:
Select K3 to K8
Home > Styles > Conditional formatting > New Rule > Use a formula to determine which cells to format.
Type in the formula above. It will automatically apply to the selected range.
Be aware that TODAY() is a volatile function which might slow down your workbook if you use it extensively.

Find cells containing not null value between date range in Excel

I have a table where Column A is a list of every day this year. In column E I have hours worked on each given day. Some of these cells are blank for days not worked. Because I've also entered work hours on some weekends, it's important I isolate the weekdays in this query
I need to know the number of WEEKDAYS from column A between the start date (A2) and TODAY where there IS A VALUE in column E.
In other words the number of NETWORKDAYS between A2 and TODAY where the value in column E is NOT NULL.
If you use Josh's suggestion but use a slight variation, e.g. in F2 copied down you can use this formula
=WEEKDAY(A2,2)
Using that version Saturdays = 6 and Sundays = 7 so to count weekdays so far this year with hours in column E you can then use COUNTIFS like this:
=COUNTIFS(A:A,"<="&TODAY(),E:E,"<>",F:F,"<6")
......or it's possible to do the same without a helper column (column F) if you use SUMPRODUCT, e.g.
=SUMPRODUCT((A2:A400<=TODAY())*(WEEKDAY(A2:A400,2)<6)*(E2:E400<>""))
The quickest way to do this is to add a column in which each cell is =WEEKDAY(A2), all the way down. This will give you the day of the week. Then just filter your data: assuming your weekend is Saturday and Sunday, filter out 1 and 7 in the 'weekday' column, then filter out blanks in Column E, and then just select Column A and the COUNT (number of cells) will be displayed in the bottom right corner.

Applying a single conditional formatting rule across a range

I'm building a yearly shift roster and I'm trying to figure out how to apply the conditional formatting to show where the weekends are. Figuring out how to define the weekend is easy, the problem here is getting the conditional formatting to cooperate with that rule.
Here's how I have my table set up for anyone trying to replicate this:
Row 1 - =LEFT(TEXT(row 2,"aaa"),1) this displays the single letter day of the week based on the date in row 2
Row 2 - The date, formatted to DD. A2 starts with 1/1/2016, B2 is =A2+1 and that is repeated all the way to column NB (=NA+1)
The conditional formatting formula I'm using is =WEEKDAY($A$2,2)>5, applied to $A$1:$A$15. Now this works great for column A, but when trying to copy it over to column B the rule is still referencing column A (however it will apply it to column B). What I'm struggling to figure out is how to get the conditional formatting rule to look at all 365 columns and then apply the conditional formatting to that single column and not the entire range. The end result here would be that the weekdays have no fill applied while the weekends are shaded.
The solution to this is to use =WEEKDAY(INDIRECT(ADDRESS(2,COLUMN())),2)>5.
Here's what's going on in each part, starting inside and working out:
COLUMN() returns the column number of the current cell (A=1, B=2, C=3, etc...), so for the sake of this example let's say you had cell A2 selected, COLUMN() will then return 1.
ADDRESS(2,1) returns a TEXT string of the absolute cell reference ("$A$2"), in this case locked to row 2.
INDIRECT("$A$2") converts the text string into the A2 cell reference.
WEEKDAY($A$2,2) evaluates the date in cell A2 (1/1/2016) and returns a numerical value based on what date of the week it is. The 2 argument sets the week as Monday (1) through Sunday (7). In this example WEEKDAY() will return a value of 5 (Friday).

Excel Convert Now() to a Number to compare against another Number

I am trying to use some logic in a spreadsheet without any macros.
First I have a sinle cell that gives the date and time. I then used the custom format on that cell to just show the "h". So only hour numbers 1 through 24 appear in this cell. (e.g. at 3:20 p.m. I get 15 in the cell). (Cell # A:1)
=now()
Second, I have a separate single column with 24 rows numbered 1-24 (Cell #'s B1:B24)
I have a third column that has logic that states "Night" shift" for numbers 23 & 0-6; "Day Shift" for numbers 7-14; and "Mid Shift" for numbers 15-22) (Cell #'s C1:C24)
=if($A$1=B1,"Night Shift","")
However, the third columns all appear blank even tough one should appear. I tried changing A1 using text(A1,"#") but I get the serial number. Is there an easy way to dynamically have a value in column C show what shift based off the hour of the day in cell A1. Column D simply concatenates all 24 cells since there will only be one number ever. (Cell # D1). Thanks for any help.
You could use a LOOKUP formula to return the shift based on a time/date value in A1, e.g.
=LOOKUP(HOUR(A1),{0,7,15,23;"Night","Day","Mid","Night"})&" Shift"
Changing the format of the cell containing the date and time does nothing to the actual contents of the cell. It will still contain a value such as 43706.75 (number of days and fractions of days since 1/1/1900).
If what you want to do is determine the shift for the date/time in A1, you could use a formula like:
=IF(AND(HOUR(A1)>=7,HOUR(A1)<15),"Day Shift",IF(AND(HOUR(A1)>=15,HOUR(A1)<23),"Mid Shift","Night Shift"))
And similar logic if you need to apply different multipliers for the salary.
If you need something else, be more specific.
By doing =now() without any formatting you get the Date and the Time. Then in cell A2 do
=(A1-INT(A1))*24
Then in cell A3 do
=INT(A2)
This gives you the hour number extracted from a date format so a comparison can be made in column C against the numbers in column B. Thanks.

Conditional formatting between values? Do I need to restructure my spreadsheet?

I would like to format all cells within the range (essentially fill them with color) of start date to end date in each row.
For example, in the picture below, you can see that cells B8 and C8 contain start and end dates, 1/1/2013 and 3/24/2013 respectively. It is formatting correctly, coloring in cells D8:08.
The header cells contain dates formatted as text. For example, cell D3 (the first J), is actually the date 1 January 2013. Similarly, cell E3 (the second J), is actually the date 8 January 2013, cell F3 is 15 January 2013, and cell G3 is January 22 2013. The pattern repeats for each month, only listing the 1st, 8th, 15th, and 22nd of each month.
PROBLEM: I believe I've got it working most of the way, but it seems to not format correctly if the dates fall outside of the dates assigned in the header cells.
For example, if I assign a start and finish date of 5/31/2013, no cells are highlighted. See below image.
I assume that's because I only have up to May 22 2013 in my header cells, but I would like to keep it to four weeks in each month.
Below is the formula I used to format, which I then applied to the whole range D8:AY43, which is essentially the whole task hierarchy.
=(D$3>=$B8)*(D$3<=$C8)
Is there anyway to change this formula to accommodate my issue (cells won't highlight if they fall outside the range of values designated in the month column headers?) Or do I have to restructure my spreadsheet?
Thanks!
An alternative while keeping "4 weeks" per month would be to change the dates in header column to reflect the end of a "week", rather than the start. So instead of January 1, January 8, January 15, etc., use January 5, January 12, January 19, & January 31. You'll need to tweak your formula to account for that change, but it would preserve the structure of your workbook.
Not 100% certain what you're doing (looks like a Gantt chart?) but looks like you're just trying to evaluate whether the date in Column D is between the start and end dates in cols B & C, in which case:
=AND($B8<=D$3,$C8>=D$3)*1
This tests whether the date in D3 falls between the start/end dates defined in columns B & C, and returns "1" if true, and "0" if false.
To put this in conditional formatting, do the rule like:
=AND($B8<=D$3,$C8>=D$3)*1=1
Here is what the rule should look like in the Conditional formatting dialog:

Resources