Notion formula with nested if conditions not working properly

I need help debugging my Notion formula. I’m building a contact management system to track when I should reach out to different people. The formula should suggest different follow-up intervals based on relationship type, but there’s an issue with two specific categories.

The “Close Friends” and “Direct Family” parts always show “Time to reach out!” regardless of the last contact date. Other relationship types work correctly.

if((prop("Relationship") == "Colleague" or prop("Relationship") == "Business" or prop("Relationship") == "Coach") and dateBetween(now(), prop("Last Contact"), "months") > 4, "Time to reach out!", if(prop("Relationship") == "Extended Family" or prop("Relationship") == "Old Friend" and dateBetween(now(), prop("Last Contact"), "months") > 1, "Time to reach out!", if(prop("Relationship") == "Close Friends" or prop("Relationship") == "Direct Family" and dateBetween(now(), prop("Last Contact"), "weeks") > 2, "Time to reach out!", "✅")))

I tried switching the time unit to “months” like the other conditions but that didn’t fix it either. What am I missing here?

Your formula has an operator precedence issue. When you write prop("Relationship") == "Close Friends" or prop("Relationship") == "Direct Family" and dateBetween(now(), prop("Last Contact"), "weeks") > 2, Notion processes the AND before the OR. So it’s checking if the relationship is “Close Friends” OR if both “Direct Family” conditions are true - not what you want. You need parentheses around your relationship checks: (prop("Relationship") == "Close Friends" or prop("Relationship") == "Direct Family") and dateBetween(now(), prop("Last Contact"), "weeks") > 2. Same fix needed for your “Extended Family” condition.

found the issue! u need to add parentheses around your or conditions. currently, notion sees it as (prop("Relationship") == "Close Friends") or (prop("Relationship") == "Direct Family" and dateBetween...) but u want it to be (prop("Relationship") == "Close Friends" or prop("Relationship") == "Direct Family") and dateBetween.... just wrap the or group in parentheses and it should work.

This boolean logic trap gets everyone at least once. AND has higher precedence than OR in Notion formulas, so your conditions aren’t grouping how you think. When you write prop("Relationship") == "Close Friends" or prop("Relationship") == "Direct Family" and dateBetween(...), Notion reads it as: relationship is “Close Friends” OR (relationship is “Direct Family” AND date condition is met). You need parentheses around each relationship group to fix the evaluation order. I hit this exact same bug building a similar tracker last year and wasted hours debugging before I caught the grouping issue.