Display Text IF Statement

lmmorris

New Member
Joined
May 1, 2017
Messages
7
I'm trying to display which quarter throuout a shift an error was made. I can get Q1 and Q2 to work but for whatever reason Q3 and Q4 returns #Value! as the result.

Formula

=IF(AND([@Time]>=--"07:00:00",[@Time]<=--"09:15:00"),"Q1",IF(AND([@Time]>=--"09:15:00",[@Time]<=--"11:30:00"),"Q2",IF(AND([@Time]>=--"11:30:00",[@Time]<=--"14:45:00","Q3"),IF(AND([@Time]>=--"14:45:00",[@Time]<=--"17:30:00","Q4",),"Night"))))

Time is formatted with custom time h:mm:ss
 
Last edited:

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
I believe your issue is that Excel only supports a maximum of 7 Functions.

Hi, it's the number of nested IF()'s that has the limitation, not the number of functions and the newer versions have a much larger maximum for nested IFS()'s anyway.

It looks like this issue was some some misplaced parentheses.

Code:
=IF(AND([@Time]>=--"07:00:00",[@Time]<=--"09:15:00"),"Q1",IF(AND([@Time]>=--"09:15:00",[@Time]<=--"11:30:00"),"Q2",IF(AND([@Time]>=--"11:30:00",[@Time]<=--"14:45:00"),"Q3",IF(AND([@Time]>=--"14:45:00",[@Time]<=--"17:30:00"),"Q4","Night"))))

It's not clear what should happen for times exactly on the boundaries but another alternative might be something like:

Code:
=LOOKUP([Time],0+{"00:00","07:00","09:15","11:30","14:45","17:30"},{"Night","Q1","Q2","Q3","Q4","Night"})
 
Upvote 0

Forum statistics

Threads
1,213,538
Messages
6,114,217
Members
448,554
Latest member
Gleisner2

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top