December 4, 2020 at 3:19 pm
Hi all,
need your help on conversion of excel formula into case statement. i tried but missing only one case. below is excel formula:
=IF(AND(Q141="EndOfDay", AD141="EndOfDay",V141=""),8,
MIN(8,
IF(OR(Q141="EndOfDay"), 0,
IF( AND( OR(Q141= "Paused", Q141= "PlannedBreak", Q141= "Completed"), AD141="EndOfDay" ),
MAX(0,T141-7),
IF(Z141="",0,
(ROUNDDOWN(Z141/10000,0)+(ROUNDDOWN(RIGHT(Z141,4)/100,0)/60)+(ROUNDDOWN(RIGHT(Z141,2),0)/(60*60)) )
- (ROUNDDOWN(J141/10000,0)+(ROUNDDOWN(RIGHT(J141,4)/100,0)/60) +(ROUNDDOWN(RIGHT(J141,2),0)/(60*60)) )
)))
))
Thanks
Abhas
December 4, 2020 at 3:24 pm
Which part of this do you need assistance with?
The absence of evidence is not evidence of absence
- Martin Rees
The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
- Phil Parkin
December 4, 2020 at 4:51 pm
Hi all,
need your help on conversion of excel formula into case statement. i tried but missing only one case. below is excel formula:
=IF(AND(Q141="EndOfDay", AD141="EndOfDay",V141=""),8, MIN(8, IF(OR(Q141="EndOfDay"), 0, IF( AND( OR(Q141= "Paused", Q141= "PlannedBreak", Q141= "Completed"), AD141="EndOfDay" ), MAX(0,T141-7), IF(Z141="",0, (ROUNDDOWN(Z141/10000,0)+(ROUNDDOWN(RIGHT(Z141,4)/100,0)/60)+(ROUNDDOWN(RIGHT(Z141,2),0)/(60*60)) ) - (ROUNDDOWN(J141/10000,0)+(ROUNDDOWN(RIGHT(J141,4)/100,0)/60) +(ROUNDDOWN(RIGHT(J141,2),0)/(60*60)) ) )))
))
Step one would be to post the column names that you're using above. For example, what's in Column "Z"???
--Jeff Moden
Change is inevitable... Change for the better is not.
December 4, 2020 at 6:48 pm
It would help if you showed some work. The general flow would be something like:
SELECT
CASE WHEN Q141 = 'EndofDay' AND AD141 = 'EndofDay' AND V141 = '' THEN 8
ELSE xx
END
RoundDown should be ROUND() in T-SQL. Min() is an aggregate, so that might cause some issues in a query, but hard to tell from here.
December 4, 2020 at 7:06 pm
Hi all,
need your help on conversion of excel formula into case statement. i tried but missing only one case. below is excel formula:
=IF(AND(Q141="EndOfDay", AD141="EndOfDay",V141=""),8, MIN(8, IF(OR(Q141="EndOfDay"), 0, IF( AND( OR(Q141= "Paused", Q141= "PlannedBreak", Q141= "Completed"), AD141="EndOfDay" ), MAX(0,T141-7), IF(Z141="",0, (ROUNDDOWN(Z141/10000,0)+(ROUNDDOWN(RIGHT(Z141,4)/100,0)/60)+(ROUNDDOWN(RIGHT(Z141,2),0)/(60*60)) ) - (ROUNDDOWN(J141/10000,0)+(ROUNDDOWN(RIGHT(J141,4)/100,0)/60) +(ROUNDDOWN(RIGHT(J141,2),0)/(60*60)) ) )))
))
Thanks
Abhas
Let's rephrase this, you need a bit of alchemy, turning turd to gold
😎
First of all, try to format the statement properly, secondly, this statement does not parse as it is incomplete
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply