$ And logic language in Excel

1. Reference types of functions

1.1 Absolute references

In excel, the formula address copied by absolute reference will not change, such as

Cell C1 has a formula: =$A$1+​$B$1
When the formula is copied to cell C2, it is still: =$A$1+$B$1
When the formula is copied to cell D1, it is still: =$A $1+$B$1

1.2 Relative references

In excel, the formula address copied by absolute reference will change, such as

Cell C1 has a formula: =A1+B1
When the formula is copied to cell C2, it becomes: =A2+B2
When the formula is copied to cell D1, it becomes: =B1+C1

1.3 Mixed references

In excel, the absolute reference copied part of the formula address will change, which is related to the $add position. If it is placed before the row, it means the row is locked, if it is placed before the column, it means the column is locked, such as:

Cell C1 has a formula: =$A1+B$1
When the formula is copied to cell C2, it becomes: =$A2+B$1
When the formula is copied to cell D1, it becomes: =$A1+C$1

1.4 Generate a 9*9 multiplication table

  1. First generate 1-9 rows (B1-J1) and 1-9 columns (A2-A10)
  2. It can be found that for rows 1-9, it needs to be fixed to the first column, which is B$1; for columns 1-9, the first row needs to be fixed, which is $A2.
  3. So the formula can be written as =B$1*$A2

Insert picture description here

2. The logical language IF/AND/OR in excel

The logical language usage in excel is almost the same as in other languages

2.1 IF

=IF(logical_test, value_if_true, value_if_false)

The IF statement may have two results. The first result is that the comparison result is True, and the second result is that the comparison result is False

For example, =IF(C2=”Yes”,1,2) means IF(C2 = Yes, then return 1, otherwise return 2)

Insert picture description here

2.2 AND

AND(logical1, logical2,...)

The AND statement is used to determine whether all conditions in the test are TRUE

For example, =AND(A2>1,A2<100) means if A2 is greater than 1 and less than 100, it will display TRUE; otherwise it will display FALSE

2.3 OR

OR(logical1, logical2,...)

OR statement is used to determine whether a condition is TRUE in the test

For example, =OR(A2>1,A2<100) means if A2 is greater than 1 or less than 100, it will display TRUE; otherwise it will display FALSE
Insert picture description here

2.4 Nested use of logic statements

Insert picture description here

Guess you like

Origin blog.csdn.net/qq_24852439/article/details/107702336