cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • DownloadSemiconductor Toolkit: Tools to create wafer maps, add wafer geometry to graphics, explore die defects & compare wafers.
  • Discovery Summit 2026: Early User Edition - September 23-24.Register. It's free.
  • Use JMP Clinical with CDISC-compliant data. Review studies, ID safety and efficacy signals & communicate findings with interactive graphics. Register to see how. Aug. 27, 2 pm US ET.

Learning Resources

Choose Language Hide Translation Bar
Example: Binning Data by Using the If Function

So let's look at an example of using the If function. Suppose you have data from a public school in the US with grade levels for each student. Some grade levels are grouped into schools, and you want to use the numeric data to group the students by school. This is an example of binning data, where the bins represent ranges of values, and the If statement is an easy way to assign the different grades to the appropriate school. Now, the key to using the If function to bin data is to order the odd numbered arguments (the Boolean expressions, or conditions), in a way that the value to be tested changes monotonically in one direction or the other. In other words, the values either only increase or only decrease in successive tests. This simplifies your code, because then you don't need to provide both a lower and an upper bound for each condition -- because remember, once a true condition is evaluated, the script returns the corresponding result and doesn't evaluate the remaining conditions.

Recommended Articles