I have a matrix in excel (pictured below) that I need the following conditions for:
(1) A cell should be orange if a time fraction and Tj are provided on the same row, AND a Ball name is provided on its respective column
(2) A cell should be blue if, on the same row, any previous current input is <= .5* the first current input on the same row, regardless of if a ball name is provided
(3) A cell should be blue if no time fraction or Tj are provided on the same row, or if no ball name is given in its respective column
(4) The cells must default to blue when nothing is entered
At the moment, the cells are filled blue, so I understand that I need to only format when the cells should become orange, but I'm having some trouble working out the logic for conditional formatting, and as its a large table, I would like to avoid having to enter a conditional format for each individual cell.
Is there a way to say, for instance, (cell) = AND(tfrac <> "", tj <> "", Ballname <> "") format(orange), and then have the row/column numbers change for each cell, to that cell's respective column/row letter/number? Thanks!
If you are new to conditional formatting, you can follow this answer I gave to a different question: Is it possible to have excel highlight cells that don't conform to my desired format (ex. date as 6.2.2021 vs the desired 6/2/2021)? which will show you how to go about it.
As to the actual conditional logic for the formula that will be used, I would try something like:
=AND($time<>"", $tj<>"", ballname="what_you_want")
Related
The conditional format rule is set as an equation doesn't behave as I expect (highlight only values that are =1 in Column M corresponding to the current row). Instead they are seemingly randomly colored.
My code is as follows:
IF($M5=1,TRUE,FALSE)
where true results in the color green, false default formatting. This formatting is copied along a column, e.g. I also expect the value M$5 to correspond with the row in the cell with formatting in column M.
I observed that the color changes sometimes when Mrow=1, sometimes not.It appears uncorrelated with the row value. See below.
Item M-column Color
#1. 1 none
#2 0.48 green
#3. 0.0. green
#4 1. green
Any suggestions to understand what to try next to fix the probelm?
Thanks
Your formula is offsetting the row by 5, either use =$M1=1 or use the conditional formatting dropdown options to select highlight cells -> Equal to...
Based on the data provided it looks like your raw data has a 1 in rows 8,9,10, which is why it formatted the cells five rows above as green.
Also, you don't need to wrap your logical test in an IF() statement, it will return TRUE or FALSE either way.
I have two columns A and B, If A Column have the specific value "High" then the corresponding cell in B Column should contain the Date (dd/mm/yyyy)value otherwise if date value is not available the cell should be highlighted as Red. I am new to this macro and I am not able to find the logic for this.
Sorry this isn't a comment, but I don't have sufficient rep.
I'm a little unclear how dates are populated in column B. Is this something we can take as given or are you assigning dates somehow? It might help if you could share a bit more about the structure of the sheet, maybe some "dummy data"?
That said, this sounds like a straightforward case of loops + conditional statements. I doubt this will work for you out of the box, but you could try nested For loops over columns A and B à la:
For Each cell in Range("A:A")
If cell.Value = "High" Then
If IsEmpty(Range("B"&cell.Row)) Then 'IsEmpty tests whether the cell is empty, you may need to change this if the cell has some other value in it
Range("B"&cell.Row).Interior.Color = 255 '255 corresponds to the color red
End If
End If
Next cell
I agree with Pᴇʜ though, you don't actually need VBA for this at all. You can apply conditional formatting using a formula for the rule and then use a formula like this for the cells in column B:
=IF(A2="High",IF(ISBLANK(B2),TRUE,FALSE),FALSE)
Then just make sure you apply the formula to all the rows you care about.
I´m trying to fill a Cell based on the words "beim Baum." which could appear in different cells in the same line. If this is true for any cell I want a particular cell to turn yellow. All cells contain words or numbers and are formatted as numbers.
So for example cell A1 contains "beim Baum." so I would like B1 to turn yellow. it should also turn yellow if C1 contains "beim Baum."
I know the conditional formatting formula for filling in a cell based on an exact word would be Rule $A1="beim Baum." Applies to =$B1, but this does not work.
I also tried: =SEARCH("beim Baum.",$B1)
and: =ISNUMBER(SEARCH("beim Baum.",$B1))
No matter which formula nothing happend
The ISNUMBER SEARCH approach is correct.
Lets have complete example:
Conditional formatting rule based on formula:
=ISNUMBER(SEARCH("beim baum",$A1&$C1))
is applied to =$B$1:$B$8.
I have a list of students who are between the ages of 3 and 5. lets say column A has the code, Column D has the childs age & Column F has their age group (3-5) If their age exceeds the age group then the Cell in column A will highlight Red. I am just not sure how to write this code correctly, all of the combinations i have tried come up with an error or just don't do anything.
IF(OFFSET(INDIRECT(ADDRESS(ROW(),COLUMN())),0,7)="3-5" & (OFFSET(INDIRECT(ADDRESS(ROW(),COLUMN())),0,4)>5 {THEN FILL CELL RED} {ELSE NO FILL}
In the first part of the statement you are checking whether the cell 7 columns across = "3-5". You don't need to use offset for this, you can just reference the cell 7 across directly.
So if you're applying the conditional formatting to A1 that part of the formula would just be =IF(H1="3-5",{then},{else}).
If you just want TRUE or FALSE as the answer you don't need the IF statement, so this shortens to: =H1="3-5",
If you're applying the conditional formatting to a range instead of just an individual cell, say A1:B10, then you write the formula for the cell in the top left of the that range. So for A1:B10 you would still you the same formulae as above.
For the second part of the statement, using the same logic as above, you get: =E1>5
To check both statements together you need to wrap them in the =AND() function, giving you this as the final formula for your conditional formatting:
=AND(H1="3-5",E1>5)
By using the AND function I can achieve the desired result without cell references moving if a cell is relocated.
=AND(OFFSET(INDIRECT(ADDRESS(ROW(),COLUMN())),0,7)="3-5yo",OFFSET(INDIRECT(ADDRESS(ROW(),COLUMN())),0,4)>5)
I'm putting to good use one of the Excel posts on Conditional Formatting, but I'm having trouble applying it to multiple cells. I have a row of cells:
F4;G4;H4;I4;J4
in which G4 is a Yes/No dropdown list (these values come from another sheet). I tried:
Conditional Formatting > New Rule > Use a formula to determine which cells to format
in the Format values where this formula is true I inserted =(G4="No") and it would apply bold + gray + strikethrough to the row of cells mentioned above (including G4).
Problem: when I change the G4 value to No, only the first cell - F4 - changes.
What am I doing wrong?
As mentioned by #hsan:
=$G4="No" should work
but also the "Applies to" range should be:
=$F$4:$J$4
Without the anchor ($) the references are relative, so F triggers the formatting because, relative to F, G is one column to the right and from F one column to the right shows No. It may be easier to see what is happening if, with the “wrong” formula (but the same Applies to range of F:J) you change the content of J4 to No. I4 should now be formatted bold+grey+strikethrough.
Maybe think of the CF as rastering through the specified range, so where that is =$F$4:$J$4, it starts in F4 and considers “does G4 equal No?” then steps to G4 and asks “does H4 equal No?” – and so on.
With the anchor, the comparison is against ColumnG at every step in the cycle.