Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello, my If statements are not working properly. The idea behind this is that when one clicks on a Code in the Listbox, it will narrow down the results to the ones containing that code. However, if no Code is selected in the listbox, it will display the Sum of the values.
Currently, if the code does not match 1 through 8, it is by default just selecting Code 1 and using those values, rather than the sum of all values as I want it to.
Here is my code:
if(Code = '1', Montreal,
if(Code = '2', Gagetown,
if(Code = '3', Valcartier,
if(Code = '4', Meaford,
if(Code = '5', Petawawa,
if(Code = '6', [Edmonton Spares],
if(Code = '7', Edmonton,
if(Code = '8', Wainwright,
(Sum(Montreal + Gagetown + Valcartier + Meaford + Petawawa + [Edmonton Spares] + Edmonton + Wainwright))))))))))
Any help is greatly appreciated.
Thanks,
Alec
surround all expressions with sum()
if(Code = '1', sum(Montreal),
if(Code = '2', sum(Gagetown),
if(Code = '3', sum(Valcartier),
if(Code = '4', sum(Meaford),
if(Code = '5', sum(Petawawa),
if(Code = '6', sum([Edmonton Spares]),
if(Code = '7', sum(Edmonton),
if(Code = '8', sum(Wainwright),
(Sum(Montreal + Gagetown + Valcartier + Meaford + Petawawa + [Edmonton Spares] + Edmonton + Wainwright))))))))))
Thank you for your reply. Unfortunately, that did not fix the issue though. Do you have any other ideas?
Thanks,
Alec
It would be easier if you post a sample of you app
How about this:
If(Code = '1', sum(Montreal),
If(Code = '2', sum(Gagetown),
If(Code = '3', sum(Valcartier),
If(Code = '4', sum(Meaford),
If(Code = '5', sum(Petawawa),
If(Code = '6', sum([Edmonton Spares]),
If(Code = '7', sum(Edmonton),
If(Code = '8', sum(Wainwright),
(RangeSum(Montreal, Gagetown, Valcartier, Meaford, Petawawa, [Edmonton Spares], Edmonton, Wainwright)))))))))