Hi, I have an script that need to incorporate this excel formula. Anybody can help me to transform this into SQL code like case statement. thank you in advance.

=IF(O14=0,0,IF(SUM(N14:O14)-(Q14+R14+V14)<0,0,SUM(N14:O14)-(Q14+R14+V14)-X14))

Hi, I have an script that need to incorporate this excel formula. Anybody can help me to transform this into SQL code like case statement. thank you in advance.

=IF(O14=0,0,IF(SUM(N14:O14)-(Q14+R14+V14)<0,0,SUM(N14:O14)-(Q14+R14+V14)-X14))

There's no direct equivalent in SQL Server for an Excel range such as "N14:O14". Assuming you can get that value into a column named that, you can do something like this:

```
CASE WHEN O14 = 0 THEN 0
WHEN [N14:O14] - (Q14+R14+V14) < 0 THEN 0
ELSE [N14:O14] - (Q14+R14+V14) - X14
END
```