Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.

1. ## Ternary Operator Help

Can anyone help me write this Excel formula in C/C++
Code:
`=IF(C3>300000;IF(C3>600000;IF(C3>900000;IF(C3>1200000;IF(C3>1800000;IF(C3>2399999;300000);210000);90000);60000);45000);0)`

• I'm not totally sure on Excel's syntax, but it could be something like this.
Code:
```if (C3 > 300000)
{
if (C3 > 600000)
{
if (C3 > 900000)
{
if (C3 > 1200000)
{
if (C3 > 1800000)
{
if (C3 > 2399999)
return 300000;
else
return 210000;
}
else
return 90000;
}
else
return 6000;
}
else
return 45000;
}
else
return 0;```
Edit: Oops. I just noticed that you specified ternary operator in your thread title. See if this works for you.
Code:
`return C3 > 300000 ? (C3 > 600000 ? (C3 > 900000 ? (C3 > 1200000 ? (C3 > 1800000 ? (C3 > 2399999 ? 300000 : ) : 210000) : 90000) : 60000) : 45000) : 0;`

•

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•