Dynamic Conditional Formatting? - excel

I am working on a data trending worksheet that will have new data entered daily or weekly depending on the room. I am currently trying to get the average of the data in let's call it A(X), and I want to format the cell such that
IF value(A(X))>=value(B(X)) && value(A(X)) < value(C(X))
Fill Yellow
IF value(A(X))>=value(C(X))
Fill Red
Else
No Fill
Where B(X) contains a value that occasionally changes that warrants a warning (hence yellow) and C(X) contains a value that occasionally changes that warrants immediate action (hence red).
This data is being graphed as well. Everything I've tried limits me to only selecting a single comparison cell for the entire rule, which would make me have to hardcode every additional line. I've tried using OFFSET and haven't had any luck.

you may change the $A1>=$B1 to =if(AND($A$1>=$B$1,$A$1<=$C$1),1,0) in the formula for Yellow .. Then I think you're done. ( :

Related

COUNTIFS ignoring rows based on values in row

I have been struggling with these two problems for the better part of the day. Please see this link to an example: https://docs.google.com/spreadsheets/d/1odU7oqc-WviLzQcghkbYbQG-4DC70-Q_hszb22Chljw/edit?usp=sharing
This is a simplified document I use to see which lecturer (name) has has added which of the 5 documents (on the right) to an online learning environment (one row for each course). The courses can be given in semester 1, 2, or in both. I want to use this document to automatically highlight a name if any of the five boxes on the right is empty if the semester I want to check (Cell D1) is similar to Column E. Furthermore, only the first time a name appears in red, should the e-mail appear so as well.
For this, I of course use conditional formatting (please see those formulas, also pasted in column M (range column C and D) and N (Range column D). N is the white conditional formatting overruling M, in which a N="TRUE" means it is whitened out).
Example 1 (Ans) shows how I intend the programme to work. The first instance shows shows both the name and e-mail in red, later instances do too unless the semester is not similar or all boxes on the right are ticked.
Example 2 (Bertrand) shows the first problem. If the first instance of a red name and e-mail occurs in a semester 'both', the second time the name should be red the e-mail does so as well. This keep occurring until a semester is similar to Cell D1, after which it is normal again.
Example 3 (Carel) shows the second problem. If the first instance in which a certain lecturer occurs all boxes on the right are ticked, the second time he occurs but does not tick all boxes his name shows in red but his e-mail doesn't.
I think problem 1 (example 2) is solved if I can get 'both' to somehow mean both 1 and 2, but I don't know how.
I think problem 2 (example 3) is solved if I can get COUNTIFS to ignore the rows is which all five boxes are ticked.
However, I have no clue how to do this. Is anyone able to help me with either (but ideally both) problems?
Thank you in advance!
I'm not entirely sure, but I think I've understood what you need.
For the first part (where a lecturer has less than all 5 subjects containing 'x' AND where E is either the value of cell D1 or the value of 'both'), try this:
Delete both of your existing conditional formatting rules.
Create a new conditional formatting rule for range = C4:C21 (or perhaps further down your sheet to row 977), with a custom formula of:
=AND(COUNTIF($G4:$K4,"x")<5,or($E4=$D$1,$E4="both"))
The style for the rule should have a red background.
For the second part (updated), this is a bit tricker with conditional formatting but I can offer a solution determined by the value of cells, like you had.
Delete the contents of cells M4:N21 (21 being where you have a formula in the furthest cell).
In cell M4, add the following formula:
=arrayformula(if(iferror(if(ifs(E4:E=$D$1,1,E4:E="both",1)+if(G4:G&H4:H&I4:I&J4:J&K4:K <>"xxxxx",1,)=2,D4:D,),)<>"",countifs(iferror(if(ifs(E4:E=$D$1,1,E4:E="both",1)+if(G4:G&H4:H&I4:I&J4:J&K4:K <>"xxxxx",1,)=2,D4:D,),),iferror(if(ifs(E4:E=$D$1,1,E4:E="both",1)+if(G4:G&H4:H&I4:I&J4:J&K4:K <>"xxxxx",1,)=2,D4:D,),),row($E4:$E),"<="&row($E4:$E))=1,))
It might seem a little complex, but it's done this way to use the functions that are compatible with ARRAYFORMULA so that it will keep working down the sheet as far as you have values in rows.
Now create a new conditional formatting rule for range = D4:D21 (or perhaps further down your sheet to row 977), with a custom formula of:
=$M4=true
The style for the rule should have a red background.

Allow text to overflow into adjacent cells (based on size not length)

I have an issue that may or not be resolved with the use of VBA (with perhaps a function etc.), but preferably not. I have created a progress bar (see picture below) and was wondering if there is a way to enlarge the number showing the progress (in percentage) without getting the "##" response. In essence, I wonder if there is a way to "allow" the number to be shown in the adjacent cells - opposite to the "Wrap text" function. I'm reluctant to increase the width of my columns due to design reasons with information that are to be placed above the progress bar.
If relevant, there is about 40 columns and the progress (as seen by order of fill from the left) is 0%, 3%, 5%, 8%, 10%, 13%....etc., and the reason for this is to save time and produce something that is "good enough". Each cell have a conditional format deciding wether or not to fill the cell. In additional, each cell have an "IF" formula that determines where the actual progress (in percentage) are to be typed.
Image:
https://imgur.com/a/infd9lT
Any ideas?
OK well I'm assuming that your percentage is based on a calculation - say of current date compared to start and finish date. So your actual formula might look like this:
=IF(AND(($D3-$D1)/($D2-$D1)>=ROUND((COLUMN()-1)*0.025,2),($D3-$D1)/($D2-$D1)<ROUND((COLUMN())*0.025,2)),TEXT(($D3-$D1)/($D$2-$D$1),"0%"),"")
where D1 is start date, D2 is finish date, and D3 is current date.
Your conditional formatting formula would be:
=($D3-$D1)/($D2-$D1)>=ROUND((COLUMN()-1)*0.025,2)
Putting in today's date.
I could think of one or two wrinkles like what about 100%? At the moment it would appear to the right of the progress bar- same with 0%, the the first cell gets coloured green before any progress has been made. You could make some adjustments but as you say it's probably good enough.

Alternating Color of Rows with Merged Rows in Leading Column - Excel 2016

I'm trying to create an Excel sheet that will be tracking some of our autonomous processes and their access privileges at my company and I've run into an issue with Excel..
I'm trying to alternate row colors, which in and of itself isn't an issue, however the fact that I've got merged rows are giving me issues.
As of right now I've got 5 columns with headers in A through E. Column F is being used for conditional formatting to color the rows. In column F this formula is present:
=MOD(IF(ROW()=2,0,IF(A2=A1,F1, F1+1)), 2)
This works great if I want to repeat the leading Column item over and over, however I'd like to reduce the visual clutter and increase clarity, so I've merged some of the rows in the Column A because multiple rows in B:E correspond to it.
I've merged A2:A4 right now and the formula picks up the A2 and A4 as blank, but A3 (the text in the merged cell is centered) is recognized as different that A2 and A4 because the text resides there. I'll upload an image to give a better idea of what I'm talking about as well.
If anyone can give me a tip on how to alternate row colors with merged cells/rows that'd be great, I've done a lot of googling and searching on stackoverflow, but for the most part I've only found things that pertain to unmerged rows/cells.
Image Example: https://imgur.com/a/UDbRVWA
=IF() Condition that worked for me:
=MOD(IF(ROW()=2,0,IF((A2=0),IF((OR(A1<>0,A2=A1)),F1, F1+1),F1+1)), 2)
There is an answer below with a picture I posted, however, for most situations I would recommend the method suggested by #BruceWayne. It's far more sensible than working with merged cells!
I ended up finding a solution with just some clever working with the Conditional IF() statements. I think the key was taking into account that the Merged Cells that weren't the top (i.e. If I merged A2:A4, A2 is top, A3, A4 bottom) were equal to 0 while the top was set to the value of the text within the merged cell. Using the formula below I was able to achieve the result I was after:
=MOD(IF(ROW()=2,0,IF((A2=0),IF((OR(A1<>0,A2=A1)),F1, F1+1),F1+1)), 2)
And here is a linked screenshot: https://imgur.com/a/gNaC62c
I then just added conditional formatting for every row but row 1: =$F2=1. I'll be hiding column F to make it seem less obtrusive.
For future reference, I would agree with what #BruceWayne mentioned in that a simpler formatting that gets the job done would be preferable. There are many other ways to format this in a way that makes much more sense, but I felt like I was close when I was tinkering with it, so I stuck with it another 15 minutes or so and was able to pull out a usable formatting condition.
Might I make a suggestion? If the merging rows is to increase clarity with repeated entries, perhaps we can use another Conditional Formatting rule to make it more legible.
Say you have data that looks like this:
But, we don't want to see <Process #> duplicates in the A column. We could merge these cells and center it along the rows. But again, merging cells is generally frowned upon I've found. (It makes it tricky to format, conditional format, copy/paste, do any VLOOKUP()/Index/Match, etc.)
First, let's get the rows alternating colors. I'm using fill of RGB(183, 255, 253):
New Rule 1 -
Formula: =MOD(ROW(),2)
Applies To Range: $A$2:$E$9
Format: Fill with color RGB 183, 255, 253 (...or whatever you want, just note the RGB for later)
Now, we get this:
Okay, making progress. Now, let's work on hiding the duplicate values in column A.
So, let's apply some more Conditional Formats. We'll need two for column A, one to set the font to White, one to set the Font to that blue fill color.
New Rule 2 -
Formula: =AND($A3=$A2,MOD(ROW(),2)=1)
Applies To: =$A$3:$A$100
Format: Font --> Color --> RGB(183, 255, 253)
New Rule 3 -
Formula: =AND($A3=$A2,MOD(ROW(),2)=0)
Applies To: =$A$3:$A$100
Format: Font --> Color --> White
Now we have:
IMO, we can do one more thing to clarify the breaks in Processes:
New Rule 4 -
Formula: =$A2<>$A1
Applies To: =$A$2:$E$100
Format: Border --> Top Border
Now, we have a nice new CF table.

=IFERROR(VLOOKUP

i have this formula =IFERROR(VLOOKUP(H4,Names!A:Q,16,0),"N/A") it works but only takes the top cell value and i need it to add up all cells in the row matching the value in "H4"
table extracting data from
table extracting data too, where the formula in question is used
here is the example, i need the rows connecting to "mac" to add together in a separate table cell eg: 19:00 = 31, 20:00 = 38
can anyone help with this?
Try this,
=sumifs(p:p, a:a, h4)
By the looks of it, you have merged cells in Names!A:A - so have brought problems on yourself. One solution is to unmerge (and avoid ever merging anything ever again!) and if you only want each Name to be shown the one time fill in the other instances but avoid displaying them (such as by blending the font colour into the background colour - such as with Conditional Formatting).
The filling in is easy with the technique here.
Then #Jeeped's solution should serve, provided you qualify the ranges with the sheet name:
=SUMIFS(Names!P:P,Names!A:A,H4)

If "0" then leave the cell blank

I am trying to create a simple ledger and on the far right of the "Book" it totals any debit/credit that I input. But instead of leaving the unused rows blank, it keeps repeating the latest total to the bottom of the page.
How Can I make that cell blank if the equation equals 0?
=H15+G16-F16
is the formula I am currently using.
You can change the number format of the column to this custom format:
0;-0;;#
which will hide all 0 values.
To do this, select the column, right-click > Format Cells > Custom.
Use =IF(H15+G16-F16=0,"",H15+G16-F16)
=iferror(1/ (1/ H15+G16-F16 ), "")
this way avoids repeating the central calculation (which can often be much longer or more processor hungry than the one you have here...
enjoy
Your question is missing most of the necessary information, so I'm going to make some assumptions:
Column H is your total summation
You're putting this formula into H16
Column G is additions to your summation
Column F is deductions from your summation
You want to leave the summation cell blank if there isn't a debit or credit entered
The answer would be:
=IF(COUNTBLANK(F16:G16)<>2,H15+G16-F16,"")
COUNTBLANK tells you how many cells are unfilled or set to "".
IF lets you conditionally do one of two things based on whether the first statement is true or false. The second comma separated argument is what to do if it's true, the third comma separated argument is what to do if it's false.
<> means "not equal to".
The equation says that if the number of blank cells in the range F16:G16 (your credit and debit cells) is not 2, which means both aren't blank, then calculate the equation you provided in your question. Otherwise set the cell to blank("").
When you copy this equation to new cells in column H other than H16, it will update the row references so the proper rows for the credit and debit amounts are looked at.
CAVEAT: This equation is useful if you are just adding entries for credits and debits to the end of a list and want the running total to update automatically. You'd fill this equation down to some arbitrary long length well past the end of actual data. You wouldn't see the running total past the end of the credit/debit entries then, it would just be blank until you filled in a new credit/debit entry. If you left a blank row in your credit debit entries though, the reference to the previous total, H15, would report blank, which is treated like a 0 in this case.
An accrual ledger should note zeroes, even if that is the hyphen displayed with an Accounting style number format. However, if you want to leave the line blank when there are no values to calculate use a formula like the following,
=IF(COUNT(F16:G16), SUM(G16, INDEX(H$1:H15, MATCH(1e99, H$1:H15)), -F16), "")
That formula is a little tricky because you seem to have provided your sample formula from somewhere down into the entries of the ledger's item rows without showing any layout or sample data. The formula I provided should be able to be put into H16 and then copied or filled to other locations in column H but I offer no guarantees without seeing the layout.
If you post some sample data or a publicly available link to a screenshot showing your data layout more specific assistance could be offered. http://imgur.com/ is a good place to host a screenshot and it is likely that someone with more reputation will insert the image into your question for you.
An example of an IF Statement that can be used to add a calculation into the cell you wish to hide if value = 0 but displayed upon another cell value reference.
=IF(/Your reference cell/=0,"",SUM(/Here you put your SUM/))
Use this
=IFERROR((H15+G16-F16)^2/(H15+G16-F16),"")

Resources