Apr 29 2021 01:23 PM - edited Apr 29 2021 01:28 PM
I'm looking to create an if statement that returns the 4 scenarios listed below. The highlighted scenarios in red are where I seem to be having difficulties.
Confirmed Late = Actual Delivery is after Target Delivery
Unconfirmed Late = Actual Delivery is blank and the current date is after Target Delivery
On Time = Actual Deliver is before Target Delivery
In Transit = Actual Delivery is blank and the current date is before Target Delivery
My current formula:
=IF([@[Actual Delivery]]>=[@[Target Delivery (Late)]], "Confirmed Late", IF([@[Actual Delivery]]<[@[Target Delivery (Late)]],"On Time", ""))
Data sample attached - any help would be greatly appreciated!!
Apr 29 2021 02:02 PM
The main problem is that columns A and B contain text values that look like dates, not real dates. A tell-tale sign is that they are left-aligned.
Once you have corrected that, you can use the formula
=IF([@[Actual Delivery]]="",IF([@[Target Delivery (Late)]]>NOW(),"In Transit","Unconfirmed Late"),IF([@[Actual Delivery]]<=[@[Target Delivery (Late)]],"On Time","Confirmed Late"))
Apr 29 2021 02:04 PM
Perhaps
=IF([@[Actual Delivery]]="",
IF(NOW()<[@[Target Delivery (Late)]],"In Transit","Uncomfird late"),
IF([@[Actual Delivery]]<[@[Target Delivery (Late)]],"On Time","Confirmed late")
)
Apr 29 2021 02:17 PM
Hi thanks for the insight, I've corrected the dates! The formula provided seems to get me most of the way there but appears to miss the "unconfirmed late" piece.
The highlighted fields in the screenshot are returning as In Transit but should flag as Unconfirmed late because it is now after the Target Delivery Date.
Apr 29 2021 02:19 PM
I went ahead and tried this formula but it seems to be missing the "Unconfirmed Late" flag. he highlighted fields in the screenshot are returning as In Transit but should flag as Unconfirmed late because it is now after the Target Delivery Date.
Apr 29 2021 02:52 PM
The dates are still left-aligned, so I suspect they are still text values instead of dates.
Apr 29 2021 03:04 PM
@Hans Vogelaar the dates aren't text values, they're in date format. I've attached the file for reference.
Apr 29 2021 03:44 PM
They ARE text values, not dates, even though they look like dates and the number format is Date. You can see this because the values are left-aligned while horizontal alignment is set to General. Real dates are right-aligned. And the formula =ISTEXT([@[Target Delivery (Late)]]) returns TRUE:
Your formulas won't work correctly until you have converted the text values to real date/time values. You might try the following:
Enter 1 in an empty cell.
Copy it.
Select the target delivery values.
Right-click in the selection and select Paste Special...
Select Multiply and click OK.
If necessary, apply a date+time format.
Does that make the values right-aligned?
If so, you can do the same for the actual delivery values. Make sure not to include the empty cells.
Apr 29 2021 04:40 PM
Apr 30 2021 12:41 AM
SolutionThe problem was that Excel expects a space before AM/PM. I have converted the values for you - see attached.
Apr 30 2021 12:41 AM
SolutionThe problem was that Excel expects a space before AM/PM. I have converted the values for you - see attached.