Sunday, September 5, 2021

TI-Nspire CX II and TI-84 Plus CE: COUNTIF, SUMIF, AVERAGEIF

TI-Nspire CX II and TI-84 Plus CE:  COUNTIF, SUMIF, AVERAGEIF


Introduction


Three popular spreadsheet functions are operating on elements of a list contingent of a criteria.   


Let L be a list of numerical data.


COUNTIF(L, criteria):   returns a count of all the elements that fit a criteria


SUMIF(L, criteria):  returns the sum of all the elements that fit a criteria


AVERAGEIF(L, criteria):  returns the arithmetic average of all the elements that fit a criteria


Example:


L = {0, 1, 2, 3, 4, 5, 6}


COUNTIF(L, "≥4") = 3.  

Counts all the elements of L that are greater than or equal to 4.


SUMIF(L, "≥4") = 15

Sums all the element's of L that are greater than or equal to 4. 


AVERAGEIF(L, "≥4") = 5

Returns the arithmetic average of L that are greater than or equal to 4.


Note that:


AVERAGEIF(L, criteria) = SUMIF(L, criteria) ÷ COUNTIF(L, criteria)


TI-Nspire CX II:  The functions countif and sumif


The TI-Nspire has two built in functions countif and sumif.  The averageif can easily be defined in the equation from the last section.


You can download a tns demonstration document here:  

https://drive.google.com/file/d/1XfRyHSQz92TXGmzohhej0--wLYS0yxkF/view?usp=sharing


TI-84 Plus CE Programs:  LISTIF


The program LISTIF calculates all three functions COUNTIF, SUMIF, and AVERAGEIF.  There are two custom lists that are created as a result of this program:


List A:  The input list.


List B:  The list that meets the criteria.


To get the small "L" character, press [ 2nd ], [ stat ] (LIST), B* for the small L.   The small L must be the first character of your list name.  Once created, custom lists are shown under the LIST - NAMES menu.


Although I did not test this on previous calculators, this program should work on the TI-82, TI-83 family, and all of the TI-84 Plus family.


Program listing:


Download Link:

Eddie

All original content copyright, © 2011-2021.  Edward Shore.   Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited.  This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author.