I had a task where I wanted to compare one date column with another and to achieve something like this:

In your list settings click Add Column and select Calculated Field

The formula that finally worked was this:

=IF(ISBLANK([Completed Date]),”In Progress”,[Due Date]>=[Completed Date])

If you want to customize what it says instead of yes or no then this is the code:

=IF(ISBLANK([Completed Date]),”In Progress”,IF([Due Date]>=[Completed Date], “True”, “False”)

For the colors click the down arrow from my column On Time and select Format this column

Click manage rules

Click Add rule

You can use my picture above as an example of how to show certain colors for what data is in the field

for example If the column On Time is equal to No then the text will be red. Add all the conditions you want then click save.

References:

https://natechamberlain.com/2018/08/27/extract-date-components-using-the-text-function-in-sharepoint-calculated-columns/
https://natechamberlain.com/2018/03/04/using-todays-date-and-or-current-time-in-calculated-columns-and-list-view-filters/
https://support.microsoft.com/en-us/office/examples-of-common-formulas-in-lists-d81f5f21-2b4e-45ce-b170-bf7ebf6988b3
https://sharepointmaven.com/how-to-create-a-calculated-column-in-a-sharepoint-list-or-library/