Computing Lecture 3
Computing Lecture 3
Computing Lecture 3
Text
https://www.xkcd.com/1667/
1
AI News
https://www.aiin.healthcare/topics/business-intelligence/mayo-partnering-google
2
Kinds of Learning:
Reinforcement
3
What functions did we
learn last time?
4
Regex Golf:
abba answer
^(.(?!(ll|ss|mm|rr|tt|ff|cc|bb)))*$|^n|ef
5
Search Functions
MATCH
– Look for a value, return its index.
MATCH(value_to_find, range, how_to_match)
• Descending
TRUE, FALSE, Z-A, …, 2, 1, 0, -1, -2, …
The MATCH function searches for a specified
item in a range of cells, and then returns the
relative position of that item in the range. For
example, if the range A1:A3 contains the values
5, 25, and 38, then the formula
• =MATCH(25,A1:A3,0)
• returns the number 2, because 25 is the
second item in the range.
MATCH(value_to_find, range, how_to_match)
=MATCH(“Hamburger”, A2:A15, 0)
9
The INDEX formula takes in a range of values
and a row and column number and returns the
value n the range at that location.
INDEX(A1:B15,2,2) = ???
11
Match vs. Index
Use Match when you know the value you are
looking for, use Index when you know the
position/location
12
The OFFSET formula returns a reference to a
range that is a specified number of rows and
columns from a cell or range of cells. The
reference that is returned can be a single cell or
a range of cells. You can specify the number of
rows and the number of columns to be
returned.
OFFSET(ref, rows, cols, [height], [width])
– E.g. SUM(OFFSET(C2,-1,-2,3,3))
sums the range A1:C3.
OFFSET(ref, rows, cols, [height], [width])
=OFFSET(A1, 3, 0) =OFFSET(B3,4,0)
14
LARGE AND SMALL
SMALL : returns the kth smallest value in a data
set. Use this function to return values with a
particular relative standing in a data set.
=SMALL(array, k) =LARGE(array,k)
Additional Notes About SMALL
• If array is empty, SMALL returns the #NUM!
error value.
• If k ≤ 0 or if k exceeds the number of data
points, SMALL returns the #NUM! error value.
• If n is the number of data points in array,
SMALL(array,1) equals the smallest value, and
SMALL(array,n) equals the largest value.
16
SMALL(array, k) LARGE(array,k)
=SMALL(B2:B15, 3) =LARGE(B11:B15,2)
17
Reference Functions
• COLUMN(), COLUMN(A5)
ROW(), ROW(A5)
– Column and row of a cell.
• COLUMNS, ROWS
– Number of columns and rows
Search Functions
• LOOKUP
LOOKUP(value, look_in_these, return_from_these)
LOOKUP(5.0, A2:A10, B2:B10)
looks for 5.0 (or next smaller value) in A2:A10
and returns corresponding value in B2:B10.
22
Search Functions
• HLOOKUP
– Like VLOOKUP, but works with many rows.
– HLOOKUP(lookup_value, table_array,
row_index_num, Approximate_Match(1) or Exact
Match(0) )
– Value still must be in the first row.
Search Functions & Best Practice
• Briefly consider ‘Code in the Wild’
https://www.youtube.com/watch?v=F264FpBDX28
Conditional Formatting
https://www.youtube.com/watch?v=m0wI61ahfLc
Bookkeeping
Quiz
• First quiz is next week (Oct 3rd)