0% found this document useful (0 votes)
5 views1 page

Logic-functions_Reference-card_Final-3708

Uploaded by

You Nes
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views1 page

Logic-functions_Reference-card_Final-3708

Uploaded by

You Nes
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Reference card

Logic functions

The dataset SWITCH function


The following dataset will be used to demonstrate Used to evaluate a logical expression and match it with one of the cases available. It then returns the value defined in that
the use of some of the logic functions in this case block. If there is no matching case, it returns the default value.
document.
=SWITCH(expression, case1, value1, [case2_or_default, …], [value2, …])
A B C
1 Original average retail prices Ex. =SWITCH(A4:A11, "Beans", "Legume", "Cabbages", "Vegetable", "Potatoes", "Vegetable",
2 KSh per Kg "Tomatoes", "Fruit", "Bananas", "Fruit", "Grain")
3 Crop March September


4 Maize 38.24 35.47 A B C D
1 Original average retail prices
5 Beans 77.16 74.67
2 KSh per Kg Food crop
6 Finger Millet 78.90 79.29 3 Crop March September category
7 Sorghum 54.07 54.01 4 Maize 38.24 35.47 Grain
8 Potatoes 31.20 30.33 5 Beans 77.16 74.67 Legume
6 Finger Millet 78.90 79.29 Grain
9 Cabbages 24.67 24.75 54.01 Grain
7 Sorghum 54.07
10 Tomatoes 58.70 68.11 8 Potatoes 31.20 30.33 Vegetable
11 Bananas 42.50 42.46 9 Cabbages 24.67 24.75 Vegetable
10 Tomatoes 58.70 68.11 Fruit
11 Bananas 42.50 42.46 Fruit

IF functions Other logical functions


IF COUNTIF AND
Used to return one value if a logical expression evaluates to Used to count cells in a range that meet a single condition. Used to return TRUE if all of the provided arguments are
TRUE and another if it evaluates to FALSE. logically true, and FALSE if any of the provided arguments
are logically false.
=IF(logical_expression, value_if_true,value_if_false) =COUNTIF(range, criterion)
=AND(logical_expression1,(logical_expression2, ...])
Ex. =IF(B4<50, "Cheap", "Expensive") → “Cheap” Ex. =COUNTIF(B4:B11, ">50") → 4
Ex. =AND(TRUE,FALSE,TRUE) → FALSE
IFS COUNTIFS
Used to evaluate multiple conditions and return a value that Used to count cells in a range that meet multiple conditions. NOT
corresponds to the first TRUE condition.
=COUNTIFS(criteria_range1,criterion1, Used to return the opposite of a logical value.
=IFS(condition1, value1, [condition2,value2, …]) [criteria_range2,…], [criterion2,…])
=NOT(logical_expression)
Ex. =IFS(B5<50,"Cheap",B5>70,"Expensive",B5<70, Ex. =COUNTIFS(B4:B11,">50",B4:B11,"<70")→ 2
"Affordable") → “Expensive” Ex. =NOT(FALSE) → TRUE
SUMIF
IFERROR
Used to add up the value of cells within a range that OR
Used to catch and handle errors in a formula. It returns a
meet a certain condition. Used to return TRUE if any argument is logically true,
value if it is not an error, otherwise it returns [value_if_error]
if present, or a blank if [value_if_error] is absent. and FALSE if all arguments are logically false.
=SUMIF(range, criterion, [sum_range])
=IFERROR(value, [value_if_error]) =OR(logical_expression1,[logical_expression2, …])
Ex. =SUMIF(B4:B11, ">50") → 268.83
Ex. =IFERROR(1/0, "Division by zero") Ex. =OR(TRUE,FALSE,TRUE) → TRUE
→ “Division by zero" SUMIFS
Used to add up the value of cells within a range that XOR
IFNA meet multiple conditions. Used to return TRUE if an odd number of arguments are
Used to catch and handle errors in a formula. It returns a logically true, and FALSE otherwise.
value if it is not an error, otherwise it returns value_if_na. =SUMIFS(sum_range,criteria_range1,criterion1,
[criteria_range2,criterion2,...])
=XOR(logical_expression1,[logical_expression2, …])
=IFNA(value, value_if_na) Ex. =SUMIFS(B4:B11, B4:B11, ">50" , B4:B11, "<70")
→ 112.77 Ex. =XOR(TRUE, FALSE, TRUE) → FALSE
Ex. IFNA(#N/A, “Na error”) → “Na error”

You might also like