Hi,
You can create a calculated column with this formula:
="<img src='/_layouts/images/blank.gif' onload='var a = new Date("&YEAR(DueDate)&","&(MONTH(DueDate)-1)&","&DAY(DueDate)&","&HOUR(DueDate)&");var b = new Date();var c = (a-b) / (1000*60*60*24);this.outerHTML = c<0?""<span style=color:red>OVERDUE</span>"":c<1?parseInt(c*24,10)+(c*24<2?"" hour"":"" hours""):parseInt(c,10)+(c<2?"" day"":"" days"")'>"
Change “DueDate” to match your field name.
You must set the “The data type returned from this formula is” to “Number (1, 1.0, 100)”. This renders the calculated value as HTML in list view, and this “trick” works in most list views in SharePoint, but will not work in the “New experience” list views in Office 365.
Please note that this column cannot be filtered as the filter value will be the HTML string.
The output will be as show in the attachment.
Hope you can use it,
Alexander