- •Solutions for Excel How to accomplish a common task in a fast, flexible and efficient way
- •Create sequential table rows and columns
- •Problem
- •Solution
- •Similar tasks
- •Fill blank range
- •Problem
- •Solution
- •Similar problems
- •Fill table with formulas with row and column inputs
- •Problem
- •Solution
- •Formula syntax
- •Similar tasks
- •Convert formula to its results
- •Problem
- •Solution
- •Similar tasks
- •A legible formula
- •Problem
- •Solution
- •Similar tasks
- •A dynamic date range
- •Problem
- •Solution
- •Formula syntax
- •Similar tasks
- •Check for a condition
- •Problem
- •Solution
- •Formula syntax
- •Similar problems
- •Select one from a range of options
- •Problem
- •Solution
- •Formula syntax
- •Similar tasks
- •Combine data from several data ranges in one
- •Problem
- •Solution
- •Formula syntax
- •Make 1 look as "q1"
- •Problem
- •Solution
- •Similar tasks
- •Problem
- •Solution
- •Similar tasks
- •Sum or count only certain values in a range
- •Problem
- •Solution
- •Formula syntax
- •Find data in a table
- •Problem
- •Solution
- •Formula syntax
- •Create a random password
- •Problem
- •Solution
- •Formula syntax
- •Get data from a cell n columns to the left or right
- •Problem
- •Solution
- •Formula syntax
- •A drop-down list of values
- •Problem
- •Solution
- •Similar tasks
- •Compare positive and negative numbers
- •Problem
- •Solution
- •Formula syntax
- •Similar tasks
- •Let formula read address name from an external cell
- •Problem
- •Solution
- •Formula syntax
- •Similar tasks
Similar tasks
Things to remember about lists:
They are only visible when the cell is active.
They cannot have labels that appear in the list instead of values they provide. There are some workarounds for that, though.
If a worksheet is not protected and validated cell is locked, your validated cell can be overwritten by just copying and pasting something over it. Watch out.
Compare positive and negative numbers
Tools: Function ABS
Level: advanced
Problem
Your company has a revolving credit line from its bank. It can borrow from bank up to a certain limit whenever your company needs cash. Every time your company has excess cash that exceeds one month of projected expenses, it pays this bank loan off – provided it still owes anything to the bank. You calculate or get from external source the loan balance and you have your company's cash position. However, the cash position is a positive number and loan balance is a negative number. If loan balance is zero, then there is no payment due, but if it is negative, then you pay the smaller of either your cash balance or sum needed to bring the loan balance to zero.
|
A |
B |
C |
D |
E |
F |
G |
1 |
Cash balance |
314 |
254 |
496 |
24 |
356 |
48 |
2 |
Loan balance |
-395 |
-461 |
-336 |
-181 |
-279 |
-232 |
3 |
Payment |
314 |
254 |
336 |
24 |
279 |
48 |
While it sounds and looks simple from a common sense standpoint, it is mind-twisting when it comes to setting up the math. How do you calculate what your company can pay the bank if it has to pay the bank at all?
Solution
We need to compare not cash and loan numbers but moduli of these numbers (modulus is a term for "absolute value" of the number without regard to the number sign). Then we need to select a smaller value, and this will be the payment.
Active cell B3.
Type or input =IF( function.
Enter ABS(B1)>ABS(B2) as "logical_test". ABS() is a function that returns the modulus of the argument.
If cash balance is greater than loan balance, the load balance can be paid off in full. Enter ABS(B2) as "value_if_true".
If cash balance is less that loan balance, cash balance goes to pay off the loan in full. Einter ABS(B1) as "value_if_false".
Close the bracket of IF function or press Enter, or click OK.
Copy cell B3 to range B3:G3.
You completed function will look as
=IF(ABS(B1)>ABS(B2),ABS(B2),ABS(B1))
Formula syntax
Code |
Variable |
Comment |
=IF( |
|
Which is greater, cash balance or loan balance if compared as moduli? |
ABS( |
Logical_test |
Cash balance modulus |
B1 |
|
Cash balance |
) |
|
Function ABS() complete |
>ABS( |
|
Loan balance modulus |
B2 |
Number |
Loan balance |
), |
|
Function ABS() complete |
ABS( |
Value_if_true |
If cash balance is greater, the payment is… |
B2 |
Number |
Loan balance as positive number |
), |
|
Function ABS() complete |
ABS( |
Value_if_false |
If loan balance is equal to cash balance or greater, the payment is… |
B1 |
Number |
Cash balance as positive number |
) |
|
Function ABS() complete |
) |
|
Function IF() complete |
