One of the most used functions in Excel is Yes , which in software development translates to “if”. This is a logical statement that denotes a condition . It is used to establish what to do if the requirement written after the “Yes” is met.
To understand what the if or if function is about, let’s look at this everyday example: If it rains today, then we won’t go to the movies. In some cases there is an action to perform if the condition is not met, that is, but ( it does not rain today), we’ll go to the movies.
In Excel, the Yes is applied to compare numerical elements and perform some action: If A, then B, but C. The syntax in the spreadsheet is similar to:
= IF (something is true, do something; if it is false, do something different).
The comparisons can be made using:
- Equal (=)
- Uneven (<>)
- Less than (<)
- Greater than (>)
- Less than or equal to (<=)
- Greater than or equal to (> =)
Examples of IF function in Excel
- = YES (A1> = 100; »Goal achieved»; »Goal not reached»).
- = YES (D2 <10; »YES”; »NO”).
- = IF (B9 = »-«; «Repeated»; »Not repeated»)
- = SIDIAS (TODAY (), F2> 30, C2 * 0.75, C2)
- = IF (AND (DAYS (TODAY (), F11)> 30, E11 <10), C11 * 0.5, IF (DAYS (TODAY (), F11), C11 * 0.75, C11))
- = COUNTIF (C2: C111; »Paid»)
- = IF SET (AND (DAYS (TODAY (), F2)> 30, E2 <10), C2 * 0.5, IF (DAYS (TODAY (), F2), C2 * 0.75, C2))
- = YES (B2> = 60, »APPROVED», »FAILED»)
- = YES (ISNUMBER (A2), «YES», «NO»)
- = IF (ISNUMBER (A2), SUM (A2, $ D $ 1), «NO»)
- = IF (A6> A7; TRUE; FALSE)
- = IF (A6> A7; »It is greater»; »It is not greater”)
- = IF (A13> A14; A13 + A14; FALSE)