How to apply conditional highlighting to column P based on specific criteria in columns A, B, and I-N for an MacBook Air spreadsheet?

I could use some help tweeting my formula.  It runs without an error, that is an improvement. But, I don’t get the intended outcome I expect.


I’m trying to apply conditional highlighting to column P (coupon) if these conditions are true:


    1. does column A contain “credit” 
    2. if true, check column B to insure it does NOT contains text “OLS Earnings” or “OLS Payout” or “Return
    3. if steps 1 & 2 are true, then check columns I thru N to insure none are check (false)
    4. if all are true, then put “#” in column R.  


Column R is the helper cell to apply conditional highlights to column P (coupon).


P4 and P8 are the only cells that should have the conditional highlight rule applied. I manually applied the highlighting (yellow) to show indented outcome.


I cannot pinpoint why rows P3, P7, P9, & P10 return “#”, the first 3 contain a description/text (e.g. OLS Earnings) in step 2 that should exclude them.  P10 has a checkbox (true) in K10, and it should be excluded as well.  The cells highlighted in red are the ones I think my formula should exclude. Just can’t seen to get the formula correct in to exclude the three descriptions and checkbox.


Hopefully, at this point I’ve have not completely confused you.  I'm getting lost in the ANDs & ORs.  Any help is greatly appreciated!





[Re-Titled by Moderator]

MacBook Air (M2, 2022)

Posted on Apr 22, 2025 3:48 PM

Reply
Question marked as ⚠️ Top-ranking reply

Posted on Apr 22, 2025 6:16 PM

What you want is for column R to be the same value (TRUE or FALSE) as whatever is in column P whenever you want P to be highlighted. The highlighting rule for P will be "if number is equal to the value in R then highlight with yellow fill.


I didn't test this formula but this is what I am thinking you want:

cell R2 =IF(AND(A2="Credit", B2<>"OLD Earnings", B2<>"OLS Payout", B2<>"Return", NOT(OR(I2:N2))),P2,"")

fill down to complete the column


Select cells P2 through P11 and create the rule "if Number is equal to cell R2 then yellow fill". Use the green oval to select cell R2 for the rule and the green checkmark to accept it (you'll know what I mean when you see it). This will create rules for P2 through P11 all at one time.


2 replies
Sort By: 
Question marked as ⚠️ Top-ranking reply

Apr 22, 2025 6:16 PM in response to DaThiryPointBuck

What you want is for column R to be the same value (TRUE or FALSE) as whatever is in column P whenever you want P to be highlighted. The highlighting rule for P will be "if number is equal to the value in R then highlight with yellow fill.


I didn't test this formula but this is what I am thinking you want:

cell R2 =IF(AND(A2="Credit", B2<>"OLD Earnings", B2<>"OLS Payout", B2<>"Return", NOT(OR(I2:N2))),P2,"")

fill down to complete the column


Select cells P2 through P11 and create the rule "if Number is equal to cell R2 then yellow fill". Use the green oval to select cell R2 for the rule and the green checkmark to accept it (you'll know what I mean when you see it). This will create rules for P2 through P11 all at one time.


Reply

Apr 23, 2025 11:44 AM in response to DaThiryPointBuck

@Badunit seems to have nailed the formula, but it's worth diving into what was wrong with the original formula.


The problem is that the original spreadsheet designers were kind of out there when it came to writing formulas. Most notably, the structure does not follow typical language norms.


In English, for example, you might say:


IF <this thing is true> AND <that thing is true>


which might translate to something like:


IF (A2="Credit") AND (B2="OLD Earnings")


but in spreadsheet terms this is written as:


IF (AND(A2="Credit",B2="OLD Earnings"))


It probably makes some sense in low-level computing terms, from when computers had low power and even less memory, and it's probably slightly easier to parse, especially with a lot of conditions.


The point is that in spreadsheet terms, the AND() has a comma-separate list of conditions to check. If they all return TRUE then the check passes, otherwise it fails.


This is key when performing multiple checks. For example, you might say, in English:


IF <this is true> AND <that is true> AND <something else is true>...


in spreadsheet terms this is:


IF (AND(<this is true>,<that is true>,<something else is true>))...


Similar rules apply to OR.


Note that each of the conditionals can be any function that returns a TRUE/FALSE value, but things get really gnarly, linguistically, when you try to combine AND and OR logic


For example, in English:


IF <month is April> and (day is Saturday or Sunday) then it's the weekend!


Now you have an AND() combined with an OR() statement. In spreadsheet terms, that's:


IF(
AND(
month="April",
OR(day="Saturday",day="Sunday")
),
 "Weekend",
 "Weekday"
)


Note that you do not, in spreadsheet terms, say 'If day ="Saturday" or "Sunday"...'.you have to phase it like 'if day="Saturday or day="Sunday"...' (i.e. specifying 'day' in each comparison since each check is distinct). Numbers first processes the OR() statement to see if either of the two 'day' comparisons returns TRUE, then it combines that with the AND check on the month to come up with an answer


So that's where I think your original formula went wrong. You were trying to incorporate the AND() and OR() statements in the middle of the conditionals, just as you would in English.


Hope that makes sense :)

Reply

How to apply conditional highlighting to column P based on specific criteria in columns A, B, and I-N for an MacBook Air spreadsheet?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.