# Formulas calculation (if statement)

Yes, I think there is a syntax issue. Below is what the online validator says. However, I am able to preview the form in my laptop.

I want to ask: Do you have a tubewell?
In choices, I put tubewell in two rows, 1 and 0 as names and Yes and No as labels.

Could this be why I can not ‘get selected’ form on my android?

@TushaarKOBO, check the choices sheet. There should be a label missing.

I can preview my form all right but am unable to deploy my form. I get server error (500).

What should I do?

Today morning I tried again and my form got deployed and I could also download it on my android.

Sorry to have bothered unnecessarily, and thanks a lot.

1 Like

@TushaarKOBO great to hear that you have finally solved your issue.

I want that if (tubewell) tw is equal to either dtw, etw or stw or either two of them or all of them, the respondent is a water seller; else a water buyer. I tried the following but did not work. can you pl help? Earlier, I tried ‘or’ instead of ‘and’ but that excluded respondent having 2 of three or all three and called them water buyers. Also in that case, ‘water_buyer’ came up on its own and changed only when respondent had a dtw or etw or stw.

Any guidance appreciated.
Thanks.

I also tried this; but with similar results:

Hello @TushaarKOBO,
this seems a problem of your if logic, not of KoBo, please. You may develop and test your if clause step-by-step, starting with a small combknation.

1 Like

Can you please tell me what is wrong with this calculate formula?

if((\${yd}<1000),150, if((\${yd}>1000), and (\${yd}<2500)), 200, if((\${yd}>2500), 250,’ '))

I want to say that labour needed is 150 days if crop yield is <1000 kg/acre, 200 days if yield is between 1000 and 2500 and 250 days if yield exceeds 2500 kg.

Regards,
Tushaar

Hello @TushaarKOBO,
remove the comma before the and.
You may always check your form during development with the Online validator ODK - XLSForm Online v2.x

1 Like

Thanks so much. It did the trick.
Regards,
Tushaar

1 Like

This didn’t work for me…if I put 1 , the result is 1. How can I figure out that.

Thank you.

Hi @estalyly, welcome to the community,

Can you share a screenshot of the calculation you use so we can take a closer look?

1 Like

It seems you are using the `q1` in your note, so it shows the answer of the `q1`, you need to use the question label of the calculate question

1 Like