Use the if function with calculate

Hello Kobo Users,

I am currently working on developing a form for sampling that uses a household listing and KISH Grid system. I would like to use the IF function together with calculate. Is there a way around it. Let me give an example of what am trying to do. I would like to use CALCLUATE to check IF a previous Question had a given value IF SO it concats from a different question, ELSE it checks another value to make it concat from a different Question. Has somebody ever tried using the IF function? Will really appreciate some help on this. Further still anyone developed a form based on KISH grid?

Thank you.
Aloo

One of those moments that you sort your own problem. I managed to make it work by combining it with a concat function and adding several IF operation. It runs on the system quite well. However if anyone has shorter way of doing it I will really appreciate. This is the way I wrote the calculate to enable me check 20 different questions and return String from one of 20 other questions to my question:

calculate=“if(/HHList_14A13/Kish1= 1,concat(/HHList_14A13/Member1,‘’),if(/HHList_14A13/Kish1= 2,concat(/HHList_14A13/Member2,‘’),if(/HHList_14A13/Kish1= 3,concat(/HHList_14A13/Member3,‘’),if(/HHList_14A13/Kish1= 4,concat(/HHList_14A13/Member4,‘’),if(/HHList_14A13/Kish1= 5,concat(/HHList_14A13/Member5,‘’),if(/HHList_14A13/Kish1= 6,concat(/HHList_14A13/Member6,‘’),if(/HHList_14A13/Kish1= 7,concat(/HHList_14A13/Member7,‘’),if(/HHList_14A13/Kish1= 8,concat(/HHList_14A13/Member8,‘’),if(/HHList_14A13/Kish1= 9,concat(/HHList_14A13/Member9,‘’),if(/HHList_14A13/Kish1= 10,concat(/HHList_14A13/Member10,‘’),if(/HHList_14A13/Kish1= 11,concat(/HHList_14A13/Member11,‘’),if(/HHList_14A13/Kish1= 12,concat(/HHList_14A13/Member12,‘’),if(/HHList_14A13/Kish1= 13,concat(/HHList_14A13/Member13,‘’),if(/HHList_14A13/Kish1= 14,concat(/HHList_14A13/Member14,‘’),if(/HHList_14A13/Kish1= 15,concat(/HHList_14A13/Member15,‘’),if(/HHList_14A13/Kish1= 16,concat(/HHList_14A13/Member16,‘’),if(/HHList_14A13/Kish1= 17,concat(/HHList_14A13/Member17,‘’),if(/HHList_14A13/Kish1= 18,concat(/HHList_14A13/Member18,‘’),if(/HHList_14A13/Kish1= 19,concat(/HHList_14A13/Member19,‘’),if(/HHList_14A13/Kish1= 20,concat(/HHList_14A13/Member20,‘’), ‘’))))))))))))))))))))”

···

On Sunday, April 14, 2013 11:49:08 AM UTC+3, Kenyan Aloo wrote:

Hello Kobo Users,

I am currently working on developing a form for sampling that uses a household listing and KISH Grid system. I would like to use the IF function together with calculate. Is there a way around it. Let me give an example of what am trying to do. I would like to use CALCLUATE to check IF a previous Question had a given value IF SO it concats from a different question, ELSE it checks another value to make it concat from a different Question. Has somebody ever tried using the IF function? Will really appreciate some help on this. Further still anyone developed a form based on KISH grid?

Thank you.
Aloo

Hello Kobo Users
I also noted one thing when using questions that have more than one dependent like the one below. You cannot place several of those questions in a group using the new widgets settings of appearance=“field-list”>. What KOBO Collect does is that it only computes the First One only.

Just for the record I finalized the KISH Grid form and its working pretty well.

Thanks.
Aloo

···

On Sunday, April 14, 2013 11:49:08 AM UTC+3, Kenyan Aloo wrote:

Hello Kobo Users,

I am currently working on developing a form for sampling that uses a household listing and KISH Grid system. I would like to use the IF function together with calculate. Is there a way around it. Let me give an example of what am trying to do. I would like to use CALCLUATE to check IF a previous Question had a given value IF SO it concats from a different question, ELSE it checks another value to make it concat from a different Question. Has somebody ever tried using the IF function? Will really appreciate some help on this. Further still anyone developed a form based on KISH grid?

Thank you.
Aloo

Fantastic use of the Calculate function!

I assume you are using this to select a respondent from a household of several persons.

In the field we often use a simple expedient, which is to select the person whose first name’s first letter is closest to the beginning of the alphabet. This method assumes (a widely accepted assumption) that there is nothing special about names and that Alex’s opinions are just as likely as Zed’s opinions.

I’m glad to see that this super complex Calculate function works, but I wonder if there is a simpler method available to us. What are the question’s you are asking to get these values? i.e. What are questions Member1, Member2, Member3, etc?

~Neil

···

On Sun, Apr 14, 2013 at 11:35 AM, Kenyan Aloo stepha...@gmail.com wrote:

One of those moments that you sort your own problem. I managed to make it work by combining it with a concat function and adding several IF operation. It runs on the system quite well. However if anyone has shorter way of doing it I will really appreciate. This is the way I wrote the calculate to enable me check 20 different questions and return String from one of 20 other questions to my question:

calculate=“if(/HHList_14A13/Kish1= 1,concat(/HHList_14A13/Member1,‘’),if(/HHList_14A13/Kish1= 2,concat(/HHList_14A13/Member2,‘’),if(/HHList_14A13/Kish1= 3,concat(/HHList_14A13/Member3,‘’),if(/HHList_14A13/Kish1= 4,concat(/HHList_14A13/Member4,‘’),if(/HHList_14A13/Kish1= 5,concat(/HHList_14A13/Member5,‘’),if(/HHList_14A13/Kish1= 6,concat(/HHList_14A13/Member6,‘’),if(/HHList_14A13/Kish1= 7,concat(/HHList_14A13/Member7,‘’),if(/HHList_14A13/Kish1= 8,concat(/HHList_14A13/Member8,‘’),if(/HHList_14A13/Kish1= 9,concat(/HHList_14A13/Member9,‘’),if(/HHList_14A13/Kish1= 10,concat(/HHList_14A13/Member10,‘’),if(/HHList_14A13/Kish1= 11,concat(/HHList_14A13/Member11,‘’),if(/HHList_14A13/Kish1= 12,concat(/HHList_14A13/Member12,‘’),if(/HHList_14A13/Kish1= 13,concat(/HHList_14A13/Member13,‘’),if(/HHList_14A13/Kish1= 14,concat(/HHList_14A13/Member14,‘’),if(/HHList_14A13/Kish1= 15,concat(/HHList_14A13/Member15,‘’),if(/HHList_14A13/Kish1= 16,concat(/HHList_14A13/Member16,‘’),if(/HHList_14A13/Kish1= 17,concat(/HHList_14A13/Member17,‘’),if(/HHList_14A13/Kish1= 18,concat(/HHList_14A13/Member18,‘’),if(/HHList_14A13/Kish1= 19,concat(/HHList_14A13/Member19,‘’),if(/HHList_14A13/Kish1= 20,concat(/HHList_14A13/Member20,‘’), ‘’))))))))))))))))))))”

On Sunday, April 14, 2013 11:49:08 AM UTC+3, Kenyan Aloo wrote:

Hello Kobo Users,

I am currently working on developing a form for sampling that uses a household listing and KISH Grid system. I would like to use the IF function together with calculate. Is there a way around it. Let me give an example of what am trying to do. I would like to use CALCLUATE to check IF a previous Question had a given value IF SO it concats from a different question, ELSE it checks another value to make it concat from a different Question. Has somebody ever tried using the IF function? Will really appreciate some help on this. Further still anyone developed a form based on KISH grid?

Thank you.
Aloo

You received this message because you are subscribed to the Google Groups “Kobo Users” group.

To unsubscribe from this group and stop receiving emails from it, send an email to kobo-users+...@googlegroups.com.

To post to this group, send email to kobo-...@googlegroups.com.

Visit this group at http://groups.google.com/group/kobo-users?hl=en.

For more options, visit https://groups.google.com/groups/opt_out.

Thanks for the suggestion. The problem is that the sample selection criteria am using was used in the past 7 rounds of data collection the first round was in 2000. So have to repeat it.

Basically Member 1 e.t.c are also calculate questions. Initially the interviewer collects several pieces of data on each individual house member e.g. Name Age Gender

since these are collected on several phone pages I developed a summary page that lists all household members in a group using the new widgets for appearance:fieldlist. this group contains the questions member 1 2 3 etc.

To answer your question Member 1 is a calculate question that takes the form calculate=“concat (name1,‘’, age1,‘’, gender1)”.

By listing this summary in a group it provides my enumerators a chance to observe the characteristics of all household members in a list.

They then select the members that meet their criteria by filling the corresponding member number into the KISH field list.

The if function therefore generates a similar list of the eligible members based on the KISH list.

The interviewer can then ranmdomize among the listed using a KISH grid system. I tried the calculate=“random()” it works however it cant give me a absolute particular random number between 1 and the total number eligible in a household. I managed to seed the random so that it fixes the number it generates but only gives values between 0 and 1 but excludes 1.

THE BOTTOM LINE IS I WOULD RATHER WORK EXTRA HARD TO DEVELOP A COMPLEX XML FORM AS LONG AS THE FIELD TEAM HAVE A VERY EASY AND AUTOMATED SYSTEM THAT IS AN EXACT REPLICA OF WHAT THEY WOULD HAVE DONE ON PAPER.

I need help on the random such that it generates a number between 1 and reference to a node that contains total number of eligible respondents. I get the total eligible through calculate countnotempty which works.

···

On Monday, April 15, 2013 8:48:13 PM UTC+3, Neil Hendrick wrote:

Fantastic use of the Calculate function!
I assume you are using this to select a respondent from a household of several persons.

In the field we often use a simple expedient, which is to select the person whose first name’s first letter is closest to the beginning of the alphabet. This method assumes (a widely accepted assumption) that there is nothing special about names and that Alex’s opinions are just as likely as Zed’s opinions.

I’m glad to see that this super complex Calculate function works, but I wonder if there is a simpler method available to us. What are the question’s you are asking to get these values? i.e. What are questions Member1, Member2, Member3, etc?

~Neil

On Sun, Apr 14, 2013 at 11:35 AM, Kenyan Aloo step...@gmail.com wrote:

On Sunday, April 14, 2013 11:49:08 AM UTC+3, Kenyan Aloo wrote:

Hello Kobo Users,

I am currently working on developing a form for sampling that uses a household listing and KISH Grid system. I would like to use the IF function together with calculate. Is there a way around it. Let me give an example of what am trying to do. I would like to use CALCLUATE to check IF a previous Question had a given value IF SO it concats from a different question, ELSE it checks another value to make it concat from a different Question. Has somebody ever tried using the IF function? Will really appreciate some help on this. Further still anyone developed a form based on KISH grid?

Thank you.
Aloo

You received this message because you are subscribed to the Google Groups “Kobo Users” group.

To unsubscribe from this group and stop receiving emails from it, send an email to kobo-users+...@googlegroups.com.

To post to this group, send email to kobo...@googlegroups.com.

Visit this group at http://groups.google.com/group/kobo-users?hl=en.

For more options, visit https://groups.google.com/groups/opt_out.

One of those moments that you sort your own problem. I managed to make it work by combining it with a concat function and adding several IF operation. It runs on the system quite well. However if anyone has shorter way of doing it I will really appreciate. This is the way I wrote the calculate to enable me check 20 different questions and return String from one of 20 other questions to my question:

calculate=“if(/HHList_14A13/Kish1= 1,concat(/HHList_14A13/Member1,‘’),if(/HHList_14A13/Kish1= 2,concat(/HHList_14A13/Member2,‘’),if(/HHList_14A13/Kish1= 3,concat(/HHList_14A13/Member3,‘’),if(/HHList_14A13/Kish1= 4,concat(/HHList_14A13/Member4,‘’),if(/HHList_14A13/Kish1= 5,concat(/HHList_14A13/Member5,‘’),if(/HHList_14A13/Kish1= 6,concat(/HHList_14A13/Member6,‘’),if(/HHList_14A13/Kish1= 7,concat(/HHList_14A13/Member7,‘’),if(/HHList_14A13/Kish1= 8,concat(/HHList_14A13/Member8,‘’),if(/HHList_14A13/Kish1= 9,concat(/HHList_14A13/Member9,‘’),if(/HHList_14A13/Kish1= 10,concat(/HHList_14A13/Member10,‘’),if(/HHList_14A13/Kish1= 11,concat(/HHList_14A13/Member11,‘’),if(/HHList_14A13/Kish1= 12,concat(/HHList_14A13/Member12,‘’),if(/HHList_14A13/Kish1= 13,concat(/HHList_14A13/Member13,‘’),if(/HHList_14A13/Kish1= 14,concat(/HHList_14A13/Member14,‘’),if(/HHList_14A13/Kish1= 15,concat(/HHList_14A13/Member15,‘’),if(/HHList_14A13/Kish1= 16,concat(/HHList_14A13/Member16,‘’),if(/HHList_14A13/Kish1= 17,concat(/HHList_14A13/Member17,‘’),if(/HHList_14A13/Kish1= 18,concat(/HHList_14A13/Member18,‘’),if(/HHList_14A13/Kish1= 19,concat(/HHList_14A13/Member19,‘’),if(/HHList_14A13/Kish1= 20,concat(/HHList_14A13/Member20,‘’), ‘’))))))))))))))))))))”

Hi Aloo,

Kindly take me through how to export value labels in kobocollect on a filled form.

Your timely feedback will be highly appreciated.

Kind Regards

Peter

···

On Sunday, April 14, 2013 11:49:08 AM UTC+3, Kenyan Aloo wrote:

Hello Kobo Users,

I am currently working on developing a form for sampling that uses a household listing and KISH Grid system. I would like to use the IF function together with calculate. Is there a way around it. Let me give an example of what am trying to do. I would like to use CALCLUATE to check IF a previous Question had a given value IF SO it concats from a different question, ELSE it checks another value to make it concat from a different Question. Has somebody ever tried using the IF function? Will really appreciate some help on this. Further still anyone developed a form based on KISH grid?

Thank you.
Aloo

Hello Peter,

Open your form in the Kobo Collect Design Page http://www.kobotoolbox.org/koboform/ then go to menu, SPSS, create SPSS file. You will then need to create an SPSS data from the already existing dummy files of your CSVs then export the same variable labels. One way that has worked for me is to develop an external Excel file that has the codes inbuilt but reads its data from my CSV so as the CSV changes so does the external file. This is especially helpful if you want to give control to

···

On Tue, May 21, 2013 at 12:01 PM, Peter Kinuthia peterki...@gmail.com wrote:

Hi Aloo,
Kindly take me through how to export value labels in kobocollect on a filled form.

Your timely feedback will be highly appreciated.

Kind Regards

Peter

On Sunday, April 14, 2013 11:49:08 AM UTC+3, Kenyan Aloo wrote:

Hello Kobo Users,

I am currently working on developing a form for sampling that uses a household listing and KISH Grid system. I would like to use the IF function together with calculate. Is there a way around it. Let me give an example of what am trying to do. I would like to use CALCLUATE to check IF a previous Question had a given value IF SO it concats from a different question, ELSE it checks another value to make it concat from a different Question. Has somebody ever tried using the IF function? Will really appreciate some help on this. Further still anyone developed a form based on KISH grid?

Thank you.
Aloo

You received this message because you are subscribed to the Google Groups “Kobo Users” group.

To unsubscribe from this group and stop receiving emails from it, send an email to kobo-users+...@googlegroups.com.

To post to this group, send email to kobo-...@googlegroups.com.

Visit this group at http://groups.google.com/group/kobo-users?hl=en.

For more options, visit https://groups.google.com/groups/opt_out.


Aloo Stephen Onuong’a
Public Health & Social Research Specialist
+254721260024

Hello Peter,

Open your XML form in the Kobo Collect Design Page http://www.kobotoolbox.org/koboform/
then go to menu, SPSS, create SPSS file. You will then need to create an SPSS data from the already existing dummy files of your CSVs then export the same variable labels. One way that has worked for me is to develop an external Excel file that has the codes inbuilt but reads its data from my CSV so that if the CSV changes so does the external file. This is especially helpful if you want to give control to an independent team (e.g. quality control team) without them editing your CSVs.

Regards
S.Aloo

···

On Tue, May 21, 2013 at 12:01 PM, Peter Kinuthia peterki...@gmail.com wrote:

Hi Aloo,
Kindly take me through how to export value labels in kobocollect on a filled form.

Your timely feedback will be highly appreciated.

Kind Regards

Peter

On Sunday, April 14, 2013 11:49:08 AM UTC+3, Kenyan Aloo wrote:

Hello Kobo Users,

I am currently working on developing a form for sampling that uses a household listing and KISH Grid system. I would like to use the IF function together with calculate. Is there a way around it. Let me give an example of what am trying to do. I would like to use CALCLUATE to check IF a previous Question had a given value IF SO it concats from a different question, ELSE it checks another value to make it concat from a different Question. Has somebody ever tried using the IF function? Will really appreciate some help on this. Further still anyone developed a form based on KISH grid?

Thank you.
Aloo

You received this message because you are subscribed to the Google Groups “Kobo Users” group.

To unsubscribe from this group and stop receiving emails from it, send an email to kobo-users+...@googlegroups.com.

To post to this group, send email to kobo-...@googlegroups.com.

Visit this group at http://groups.google.com/group/kobo-users?hl=en.

For more options, visit https://groups.google.com/groups/opt_out.


Aloo Stephen Onuong’a
Public Health & Social Research Specialist
+254721260024

There is a video tutorial on how this is done here:
http://www.kobotoolbox.org/videos

Video Tutorial 4: Exporting values and labels

···

On Tue, May 21, 2013 at 12:01 PM, Peter Kinuthia peterki...@gmail.com wrote:

Hi Aloo,
Kindly take me through how to export value labels in kobocollect on a filled form.

Your timely feedback will be highly appreciated.

Kind Regards

Peter

On Sunday, April 14, 2013 11:49:08 AM UTC+3, Kenyan Aloo wrote:

Hello Kobo Users,

I am currently working on developing a form for sampling that uses a household listing and KISH Grid system. I would like to use the IF function together with calculate. Is there a way around it. Let me give an example of what am trying to do. I would like to use CALCLUATE to check IF a previous Question had a given value IF SO it concats from a different question, ELSE it checks another value to make it concat from a different Question. Has somebody ever tried using the IF function? Will really appreciate some help on this. Further still anyone developed a form based on KISH grid?

Thank you.
Aloo

You received this message because you are subscribed to the Google Groups “Kobo Users” group.

To unsubscribe from this group and stop receiving emails from it, send an email to kobo-users+...@googlegroups.com.

To post to this group, send email to kobo-...@googlegroups.com.

Visit this group at http://groups.google.com/group/kobo-users?hl=en.

For more options, visit https://groups.google.com/groups/opt_out.


Aloo Stephen Onuong’a
Public Health & Social Research Specialist
+254721260024

Bonjour Aloo. J’ai une préoccupation sur la fonction “calcul”
Je vais effectuer une enquête en ville. J’ai donc créé un formulaire via le serveur kobotoolbox.
Les individus à enquêter auront
-un identifiant ID quartier (Texte
-un identifiant ID Cour (Entier)
-un identifiant ID menage (Entier)
Je voudrais utiliser la fonction “Calcul” pour générer l’identifiant du ménage qui sera:
ID quartier+ID Cour+ID menage
Merci

Deselect the cells you want to use with the IF Function. In these cells place in cells ask yourself, “What if?” For example, “What if I need to calculate Total Cost?” or “What if my Employees work is being calculated?” — and then follow these steps:
Look for a function under your function library that will do what you’re looking for - for this example, click on the function SUM. Note down the Fact Type (in this case, Cell Value) as well as Cell Reference (Range for all selected Cells)
Select All then click Insert Function from drop-down menu seen above cell reference Set Range input Select Resize Array Input Type Recalculate Output False Remove Error
You can read more about Excel If function step by step here