• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 634
  • Last Modified:

IIF statement and add hours in Excel

I have an Excel Worksheet (2003 Excel Version) that has time in one columns.  I want to write a formula that says, if you add 4 hours to the time and the

Result is Less than 5PM-   Return 5PM
Result is between 5 PM and 9PM- Return 9PM
Result is after 9PM- Return 11:59:59PM

I have the part of the formula to add 4 hours it's: =(D2+TIME(4,0,0))   .  I am not sure how to come up with the iif statement.  
1 Solution
Rory ArchibaldCommented:
You could use:

or put the values into a lookup table and reference them with a lookup formula.

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now