EXCEL Formulas Bible
EXCEL Formulas Bible
=SUMPRODUCT(--MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1))
=SUMPRODUCT((LEN(A1)-LEN(SUBSTITUTE(A1,ROW(1:9),"")))*ROW(1:9))
The above formula can be used even if contains all numbers as well.
=MAX(FREQUENCY(A1:A1000,A1:A1000))
=MAX(INDEX(COUNTIF(A1:A1000,A1:A1000),,))
=SUMPRODUCT((A1:A100<>"")/COUNTIF(A1:A100,A1:A100&""))
=SUM(IF(FREQUENCY(IF(A2:A20<>"",IF(A2:A20="A",MATCH(B2:B20,B2:B20,0))),ROW(A
2:A20)-ROW(A2)+1),1))
If you have more number of conditions, the same can be built after A2:A20 = “A”.
Note - Array Formula is not entered by pressing ENTER after entering your formula but by
pressing CTRL+SHIFT+ENTER. If you are copying and pasting this formula, take F2 after
pasting and CTRL+SHIFT+ENTER. This will put { } brackets around the formula which you
can see in Formula Bar. If you edit again, you will have to do CTRL+SHIFT+ENTER again.
Don't put { } manually.
© eforexcel.com Page 1 of 38
Excel Formulas Bible
Say, you have a date of 10/22/14 (MM/DD/YY) in A1 and you want to add number of
months which is contained in Cell B1.
=EDATE(A1,B1)
=EDATE(A1,-B1)
=EDATE(A1,12*B1)
=DATE(YEAR(A1)+B1,MONTH(A1),DAY(A1))
© eforexcel.com Page 2 of 38
Excel Formulas Bible
=EDATE(A1,-12*B1)
=DATE(YEAR(A1)-B1,MONTH(A1),DAY(A1))
=TEXT(A1*30,"mmm")
Replace "mmm" with "mmmm" to generate full name of the month like January,
February....December in any of the formulas in this post.
=CEILING(MONTH(A1)/3,1)
OR
= ROUNDUP(MONTH(A1)/3,0)
OR
=CHOOSE(MONTH(A1),1,1,1,2,2,2,3,3,3, 4,4,4)
=CEILING(MONTH(A1)/3,1)+IF(MONTH(A1)<=3,3,-1)
OR
=ROUNDUP(MONTH(A1)/3,0)+IF(MONTH(A1)<=3,3,-1)
OR
=CHOOSE(MONTH(A1),4,4,4,1,1,1,2,2,2,3,3,3)
© eforexcel.com Page 3 of 38
Excel Formulas Bible
If you have numbers like 01022016 and you want to convert this to date format, then the
following formula can be used
=--TEXT(A1,"00\:00")
=--TEXT(A1,"00\:00\:00")
=COUNTIF(A1:A10,"c*")
=COUNTIF(A1:A10,"excel*")
© eforexcel.com Page 4 of 38
Excel Formulas Bible
2. For ending
=COUNTIF(A1:A10,"*c")
=COUNTIF(A1:A10,"*excel")
=COUNT(A1:A10)
=COUNTIF(A1:A10,"*")
=LEN(SUBSTITUTE(A1," ",""))
=LEN(A1)-LEN(SUBSTITUTE(LOWER(A1),"a",""))
=IF(LEN(TRIM(A1))=0,0,SUMPRODUCT(--NOT(ISNUMBER((--
MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1))))))
=SUMPRODUCT(LEN(A1)-LEN(SUBSTITUTE(A1,ROW(1:10)-1,"")))
OR
=SUMPRODUCT(--ISNUMBER((--MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1))))
=SUMPRODUCT(LEN(A1)-
LEN(SUBSTITUTE(UPPER(A1),CHAR(ROW(INDIRECT("65:90"))),"")))
OR
=SUMPRODUCT(--(ABS(77.5-
CODE(MID(UPPER(A1),ROW(INDIRECT("A1:A"&LEN(A1))),1)))<13))
=INDEX(A1:A10,MATCH(MAX(COUNTIF(A1:A10,A1:A10)),COUNTIF(A1:A10,A1:A10),0))
=INDEX(A1:A10,MATCH(MAX(INDEX(COUNTIF(A1:A10,A1:A10),,)),INDEX(COUNTIF(A1:
A10,A1:A10),,),0))
=SUMPRODUCT(SUBTOTAL(3,OFFSET(B2,ROW(B2:B20)-ROW(B2),))*(B2:B20>14))
© eforexcel.com Page 6 of 38
Excel Formulas Bible
=SUMPRODUCT(SUBTOTAL(9,OFFSET(B2,ROW(B2:B20)-ROW(B2),))*(B2:B20>14))
If name is of 2 or 1 words, the result will be blank. This works on 3 words name only as
middle can be decided only for 3 words name.
© eforexcel.com Page 7 of 38
Excel Formulas Bible
=INT(A1)
=TRUNC(A1)
=INT(A1)*SIGN(A1) OR =TRUNC(A1)*SIGN(A1)
=INT(ABS(A1)) OR =TRUNC(ABS(A1))
=ABS(INT(A1)) OR = ABS(TRUNC(A1))
=MOD(ABS(A1),1)
=ABS(A1)-INT(ABS(A1))
=DATE(YEAR(A1),MONTH(A1),1)
=A1-DAY(A1)+1
=EOMONTH(A1,-1)+1
© eforexcel.com Page 8 of 38
Excel Formulas Bible
=SUMPRODUCT(--(TEXT(ROW(INDIRECT(A1&":"&A2)),"ddd")="Mon"))
“Mon” can be replaced with any other day of the week as per need.
=MAX(FREQUENCY(IF(A2:A20="A",ROW(A2:A20)),IF(A2:A20<>"A",ROW(A2:A20))))
Note - Array Formula is not entered by pressing ENTER after entering your formula but by
pressing CTRL+SHIFT+ENTER. If you are copying and pasting this formula, take F2 after
pasting and CTRL+SHIFT+ENTER. This will put { } brackets around the formula which you
can see in Formula Bar. If you edit again, you will have to do CTRL+SHIFT+ENTER again.
Don't put { } manually.
Case 1 - If the Day falls on the same date, then that very date (Hence, in case of 2-Jan-
17, next Monday would be 2-Jan-17 only)
© eforexcel.com Page 9 of 38
Excel Formulas Bible
Case 2 - If the Day falls on the same date, then next date (Hence, in case of 2-Jan-17, next
Monday would be 9-Jan-17 only)
Case 1 - If the Day falls on the same date, then that very date (Hence, in case of 2-Jan-
17, previous Monday would be 2-Jan-17 only)
Case 2 - If the Day falls on the same date, then previous date (Hence, in case of 2-Jan-
17, previous Monday would be 26-Dec-16 only)
=CELL("filename",$A$1)
=REPLACE(LEFT(CELL("filename",$A$1),FIND("]",CELL("filename",$A$1))-
1),1,FIND("[",CELL("filename",$A$1)),"")
=REPLACE(CELL("filename",A1),1,FIND("]",CELL("filename",A1)),"")
Make sure that A1 is used in the formula. If it is not used, it will extract sheet name for the
last active sheet which may not be one which we want.
If you want the sheet name for last active sheet only, then formula would become
=REPLACE(CELL("filename"),1,FIND("]",CELL("filename")),"")
If your workbook is located in say C:\Excel\MyDocs, the formula to retrieve the directory
for this would be
=LEFT(CELL("filename",A1),FIND("[",CELL("filename",A1))-2)
=EOMONTH(A1,0)
=DATE(YEAR(A1),MONTH(A1)+1,0)
© eforexcel.com Page 11 of 38
Excel Formulas Bible
=DATE(YEAR(A1),MONTH(A1)+1,1)-1
Now, you are having a situation where you want to do vlookup with more than 1 values. For
the purpose of illustrating the concept, let's say we have 2 values to be looked up.
Below is your lookup table and you want to look up for Emp - H and Gender - F for Age.
=INDEX(C2:C12,MATCH(1,INDEX(--((A2:A12=F2)*(B2:B12=G2)*(ROW(A2:A12)-
ROW(A2)+1)<>0),,),0))
Concatenation Approach
=INDEX(C2:C10,MATCH(F2&"@@@"&G2,INDEX(A2:A10&"@@@"&B2:B10,,),0))
@@@ can be replaced by any characters which should not be part of those columns.
CAUTION - Result of entire concatenation should not be having length more than 255.
Hence, F2&"@@@"&G2 should not have more than 255 characters.
=INDEX(C2:C12,MATCH(1,--NOT(ISLOGICAL(IF(A2:A12=F2,IF(B2:B12=G2,C2:C12)))),0))
Note - Array Formula is not entered by pressing ENTER after entering your formula but by
pressing CTRL+SHIFT+ENTER. If you are copying and pasting this formula, take F2 after
pasting and CTRL+SHIFT+ENTER. This will put { } brackets around the formula which you
can see in Formula Bar. If you edit again, you will have to do CTRL+SHIFT+ENTER again.
Don't put { } manually.
© eforexcel.com Page 12 of 38
Excel Formulas Bible
=VLOOKUP("Naomi",B:D,3,0)
But, If I have to find Emp ID corresponding to Naomi, I can not do it through VLOOKUP
formula. To perform VLOOKUP from Right to Left, you will have to use INDEX / MATCH
combination. Hence, you will have to use following formula –
=INDEX(A:A,MATCH("Naomi",B:B,0))
If perform a regular VLOOKUP on SARA, I would get the answer 4300. But in a case sensitive
VLOOKUP, answer should be 3200. You may use below formula for Case Sensitive VLOOKUP
-
© eforexcel.com Page 13 of 38
Excel Formulas Bible
=INDEX(B2:B10,MATCH(TRUE,INDEX(EXACT("SARA",A2:A10),,),FALSE))
=RANK(C2,C2:C100)
But what if you are asked to produce rank of students within each school. Hence, every
school's rank will start with 1..
Put following formula in D2 for that case for Descending order ranking. (For ascending
order, replace ">" with "<" without quote marks)
=SUMPRODUCT((B$2:B$100=B2)*(C$2:C$100>C2))+1
OR
=COUNTIFS(B$2:B$100,B2,C$2:C$100,">"&C2)+1
© eforexcel.com Page 14 of 38
Excel Formulas Bible
=SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(
SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(
SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(
SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(
SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(
SUBSTITUTE(LOWER(A1),"a",""),"b",""),"c",""),"d",""),"e",""),"f",""),
"g",""),"h",""),"i",""),"j",""),"k",""),"l",""),"m",""),"n",""),"o",""),
"p",""),"q",""),"r",""),"s",""),"t",""),"u",""),"v",""),"w",""),"x",""),"y",""),"z","")
=SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(
SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(
A1,1,""),2,""),3,""),4,""),5,""),6,""),7,""),8,""),9,""),0,"")
Note - Since this formula is in multiple lines, hence you will have to copy this in Formula
Bar. If you copy this formula in a cell, it will copy this in three rows.
=SUMPRODUCT(SMALL($A$1:$A$100,ROW(1:10)))
=SUMPRODUCT(SMALL(IF($A$1:$A$100<>0,$A$1:$A$100),ROW(1:10)))
Both the above formulas will function only if there are at least N values as per ROW(1:N).
Hence, for above formulas, it would work only if there are at least 10 numbers in A1 to
A100.
=SUM(IFERROR(SMALL($A$1:$A$100,ROW(1:10)),0))
© eforexcel.com Page 15 of 38
Excel Formulas Bible
=SUM(IFERROR(SMALL(IF($A$1:$A$100<>0,$A$1:$A$100),ROW(1:10)),0))
Non Array Versions of above formulas (For Excel 2010 and above)
=SUMPRODUCT(AGGREGATE(15,6,$A$1:$A$100,ROW(1:10)))
=SUMPRODUCT(AGGREGATE(15,6,$A$1:$A$100/($A$1:$A$100<>0),ROW(1:10)))
=SUMPRODUCT((A1:A100)*(MOD(ROW(A1:A100)-ROW(A1)+1,2)=0))
Above formula is for every 2nd row. Replace 2 with N. Hence, for every 5th row -
=SUMPRODUCT((A1:A100)*(MOD(ROW(A1:A100)-ROW(A1)+1,5)=0))
This is a generic formula and will work for any range. If you range is B7:B50, your formula
would become
=SUMPRODUCT((B7:B50)*(MOD(ROW(B7:B50)-ROW(B7)+1,2)=0))
To calculate MEDIANIF and MODEIF, enter below formulas i.e. not by pressing ENTER after
entering your formula but by pressing CTRL+SHIFT+ENTER. This will put { } brackets
around the formula which you can see in Formula Bar. If you edit again, you will have to do
CTRL+SHIFT+ENTER again. Don't put { } manually.
© eforexcel.com Page 16 of 38
Excel Formulas Bible
=MEDIAN(IF(A2:A13="M",B2:B13))
=MODE(IF(A2:A13="M",B2:B13))
Non-Array alternatives
For MEDIANIF
=AGGREGATE(16,6,(B1:B13)/(A1:A13="m"),50%)
For MODEIF
=INDEX(B1:B20,MATCH(MAX(INDEX((COUNTIF(B1:B20,B1:B20)*(A1:A20="m")),,)),IND
EX((COUNTIF(B1:B20,B1:B20)*(A1:A20="m")),,),0))
The formula which you need to use in the above case would be
=DAY(EOMONTH(A1,0))
Explanation - EOMONTH(A1,0) gives the last date of the month and DAY function extract
that particular Day from the last date of the month.
=MONTH(DATE(A1,2,29))=2
TRUE means that it is Leap Year and FALSE means that this is not a Leap Year.
=WORKDAY(EOMONTH(A1,0)+1,-1)
The above formula assumes that your weekends are Saturday and Sunday.
But, if your weekends are different (e.g. in gulf countries), you can use following formula -
=WORKDAY.INTL(EOMONTH(A1,0)+1,-1,"0000110")
© eforexcel.com Page 17 of 38
Excel Formulas Bible
Where 0000110 is a 7 character string, 1 represents a weekend and 0 is a working day. First
digit is Monday and last digit is Sunday. The above example is for Gulf countries where
Friday and Saturday are weekends.
You also have option to give a range which has holidays. In that case, your formula would
become
=WORKDAY(EOMONTH(A1,0)+1,-1,D1:D10)
=WORKDAY.INTL(EOMONTH(A1,0)+1,-1,"0000110",D1:D10)
=WORKDAY(EOMONTH(A1,-1),1)
The above formula assumes that your weekends are Saturday and Sunday.
But, if your weekends are different (e.g. in gulf countries), you can use following formula -
=WORKDAY.INTL(EOMONTH(A1,-1),1,"0000110")
Where 0000110 is a 7 character string, 1 represents a weekend and 0 is a working day. First
digit is Monday and last digit is Sunday. The above example is for Gulf countries where
Friday and Saturday are weekends.
You also have option to give a range which has holidays. In that case, your formula would
become
=WORKDAY(EOMONTH(A1,-1),1,D1:D10)
=WORKDAY.INTL(EOMONTH(A1,-1),1,"0000110",D1:D10)
=DATE(A1,1,1)+A2-1
© eforexcel.com Page 18 of 38
Excel Formulas Bible
It would give error if the range contains <=0 values. There are various ways to deal with it
and most commonly used way is to ignore <=0 values while calculating Geometric Mean.
To ignore <=0 values, you must use an Array formula i.e. which must be entered by pressing
CTRL+SHIFT+ENTER.
=GEOMEAN(IF(A1:A10>0,A1:A10))
The above formula takes into account only those values which are positive.
Bonus Tip - When %age growth are involved, you will need to use following ARRAY
formula to calculate Geometric Mean -
=GEOMEAN(IF(A1:A10>0,(1+A1:A10)))-1
You will need to use PMT function for this. It has following structure -
nper: No. of payments. Your nper and rate should be on the same scale. i.e if you are
planning to pay up monthly, the rate in your formula should be monthly only. Generally,
interest rate is specified yearly i.e. 10.5% per year. This you should divide by 12 to arrive
at monthly rate. Hence, if you wanted 3 years loan, it means nper would 3x12=36 months.
If it is quarterly, rate = 10.5%/4 = 2.625% and nper would be 3x4 = 12
If it is annual, rate = 10.5% and nper = 3
pv: Your loan amount. You will need to put negative value of this in your formula. If you
don't put negative value, your EMI would be in negative but answer would be same though
with negative sign.
+ve / -ve PMT requires some explanation though you may choose to ignore. It depends upon
your cashflow. If you are taking a loan, hence cash in, hence pv is +ve. But every month, you
© eforexcel.com Page 19 of 38
Excel Formulas Bible
will have to pay up something, hence cash out. Hence, PMT is -ve. If you are investing, hence
cash out. Hence pv is -ve. But every month, you will be receiving something, hence cash in.
Hence, PMT is +ve.
Now what is +ve or -ve is simply your preference. I recommend you should not worry about
this.
fv: Your remaining value after you finish your installment. Generally, it is 0 as any lender
will like to recover its money fill. (Default is 0)
type: 0 - At the end of the period, 1 - At the beginning of the period (Default is 0)
Also note, fv and type are optional and may not be required in your formula.
Bonus Tip = If you use ABS function, then there would be no need to put negative value of
PV. Hence, formula in this case would be =ABS(PMT(B1/12,B2,B3,B4,B5))
Excel defines IPMT as "Returns the interest payment for a given period for an investment
based on periodic, constant payments and a constant interest rate"
nper: No. of payments. Your nper and rate should be on the same scale. i.e if you are
planning to pay up monthly, the rate in your formula should be monthly only. Generally,
interest rate is specified yearly i.e. 10.5% per year. This you should divide by 12 to arrive
at monthly rate. Hence, if you wanted 3 years loan, it means nper would 3x12=36 months.
If it is quarterly, rate = 10.5%/4 = 2.625% and nper would be 3x4 = 12
If it is annual, rate = 10.5% and nper = 3
© eforexcel.com Page 20 of 38
Excel Formulas Bible
pv: Your loan amount. You will need to put negative value of this in your formula. If you
don't put negative value, your EMI would be in negative but answer would be same though
with negative sign.
+ve / -ve IPMT requires some explanation though you may choose to ignore. It depends
upon your cashflow. If you are taking a loan, hence cash in, hence pv is +ve. But every month,
you will have to pay up something, hence cash out. Hence, IPMT is -ve. If you are investing,
hence cash out. Hence pv is -ve. But every month, you will be receiving something, hence
cash in. Hence, IPMT is +ve.
Now what is +ve or -ve is simply your preference. I recommend you should not worry about
this.
fv: Your remaining value after you finish your installment. Generally, it is 0 as any lender
will like to recover its money fill. (Default is 0)
type: 0 - At the end of the period, 1 - At the beginning of the period (Default is 0)
Also note, fv and type are optional and may not be required in your formula.
Also, since Interest will vary every month, hence it makes sense to calculate it for each
month. Columns H & I carry interest for each month.
Bonus Tip = If you use ABS function, then there would be no need to put negative value of
PV. Hence, formula in this case would be =ABS(IPMT(B1/12,B2,B3,B4,B5,B6))
© eforexcel.com Page 21 of 38
Excel Formulas Bible
Excel defines PPMT as "Returns the payment on the principal for a given period for an
investment based on periodic, constant payments and a constant interest rate."
nper: No. of payments. Your nper and rate should be on the same scale. i.e if you are
planning to pay up monthly, the rate in your formula should be monthly only. Generally,
interest rate is specified yearly i.e. 10.5% per year. This you should divide by 12 to arrive
at monthly rate. Hence, if you wanted 3 years loan, it means nper would 3x12=36 months.
If it is quarterly, rate = 10.5%/4 = 2.625% and nper would be 3x4 = 12
If it is annual, rate = 10.5% and nper = 3
pv: Your loan amount. You will need to put negative value of this in your formula. If you
don't put negative value, your EMI would be in negative but answer would be same though
with negative sign.
+ve / -ve PPMT requires some explanation though you may choose to ignore. It depends
upon your cashflow. If you are taking a loan, hence cash in, hence pv is +ve. But every month,
you will have to pay up something, hence cash out. Hence, PPMT is -ve. If you are investing,
hence cash out. Hence pv is -ve. But every month, you will be receiving something, hence
cash in. Hence, PPMT is +ve.
Now what is +ve or -ve is simply your preference. I recommend you should not worry about
this.
fv: Your remaining value after you finish your installment. Generally, it is 0 as any lender
will like to recover its money fill. (Default is 0)
type: 0 - At the end of the period, 1 - At the beginning of the period (Default is 0)
Also note, fv and type are optional and may not be required in your formula.
Also, since Principal will vary every month, hence it makes sense to calculate it for each
month. Columns H & I carry Principal for each month.
Bonus Tip = If you use ABS function, then there would be no need to put negative value of
PV. Hence, formula in this case would be =ABS(PPMT(B1/12,B2,B3,B4,B5,B6))
© eforexcel.com Page 22 of 38
Excel Formulas Bible
It is fairly easy job to do it in Excel. You will need to use NPER function for this.
Excel defines NPER as "Returns the number of periods for an investment based on periodic,
constant payments and a constant interest rate."
pmt: EMI (Payment per period). You will need to put -ve value of this in your formula.
Your pmt and rate should be on the same scale. i.e if you are planning to pay up monthly,
the rate in your formula should be monthly only. Generally, interest rate is specified yearly
i.e. 10.5% per year. This you should divide by 12 to arrive at monthly rate. Hence, if you
wanted 3 years loan, it means nper would 3x12=36 months.
If it is quarterly, rate = 10.5%/4 = 2.625% and nper would be 3x4 = 12
If it is annual, rate = 10.5% and nper = 3
pv: Your loan amount. You will need to put +ve value of this in your formula.
Note - Either PMT or PV should be -ve. Both can't be +ve and -ve at the same time.
+ve / -ve requires some explanation and this can not be ignored. It depends upon your
cashflow. If you are taking a loan, hence cash in, hence pv is +ve. But every month, you will
© eforexcel.com Page 23 of 38
Excel Formulas Bible
have to pay up something, hence cash out. Hence, PMT is -ve. If you are investing, hence
cash out. Hence pv is -ve. But every month, you will be receiving something, hence cash in.
Hence, PMT is +ve.
fv: Your remaining value after you finish your installment. Generally, it is 0 as any lender
will like to recover its money fill. (Default is 0)
type: 0 - At the end of the period, 1 - At the beginning of the period (Default is 0)
Also note, fv and type are optional and may not be required in your formula.
Excel defines RATE as "Returns the interest rate per period of an annuity. RATE is calculated
by iteration and can have zero or more solutions. If the successive results of RATE do not
converge to within 0.0000001 after 20 iterations, RATE returns the #NUM! error value."
Syntax of RATE is RATE(nper, pmt, pv, [fv], [type], [guess]).
pmt: EMI (Payment per period). You will need to put -ve value of this in your formula.
Your pmt and rate should be on the same scale. i.e if you are planning to pay up monthly,
the pmt in your formula should be monthly only.
pv: Your loan amount. You will need to put +ve value of this in your formula.
Note - Either PMT or PV should be -ve. Both can't be +ve and -ve at the same time.
+ve / -ve requires some explanation and this can not be ignored. It depends upon your
cashflow. If you are taking a loan, hence cash in, hence pv is +ve. But every month, you will
have to pay up something, hence cash out. Hence, PMT is -ve. If you are investing, hence
© eforexcel.com Page 24 of 38
Excel Formulas Bible
cash out. Hence pv is -ve. But every month, you will be receiving something, hence cash in.
Hence, PMT is +ve.
fv: Your remaining value after you finish your installment. Generally, it is 0 as any lender
will like to recover its money fill. (Default is 0)
type: 0 - At the end of the period, 1 - At the beginning of the period (Default is 0)
guess: If you omit guess, it is assumed to be 10 percent. If RATE does not converge, try
different values for guess. RATE usually converges if guess is between 0 and 1. Once again,
note that if PMT is monthly, then Guess should also be monthly. Hence, if you are giving
annual interest rate of 12%, guess should be given as 12%/12 = 1%.
Also note, fv, type and guess are optional and may not be required in your formula.
Excel help describes FV as "Returns the future value of an investment based on periodic,
constant payments and a constant interest rate".
© eforexcel.com Page 25 of 38
Excel Formulas Bible
nper: Total number of periods for which compounding needs to be done. Now rate and nper
should be on the same scale. If interest rate is monthly, then nper should be in months. If
interest rate is quarterly, then nper should be in quarter. If interest rate is annual, then nper
should be in years.
pv: This is the initial principal and it has to be specified in -ve. (Note, I have already
discussed significance of +ve and -ve in many previous tips on Financial Functions.)
=FV(B1/12,B3*12,0,-B2)
=FV(F1/4,F3*4,0,-F2)
=FV(J1,J3,0,-J2)
But actually interest rate of 1% (nominal monthly interest rate) is compounded every
month, hence your effective interest rate per year becomes higher. But lending financial
institutions doesn't quote this higher rate as it will make your loan cost look higher.
To calculate Effective Interest Rate, Excel has provided a function called EFFECT.
© eforexcel.com Page 26 of 38
Excel Formulas Bible
Excel describes EFFECT - Returns the effective annual interest rate, given the nominal
annual interest rate and the number of compounding periods per year.
npery - Compounding periods in a Year. For monthly payments, it is 12. For quarterly
payments, it is 4.
In the below picture, the effective interest rate is 12.68% for a monthly payment. This may
be a small difference for a year or two, but if you take mortgage on housing which is say for
20 years, this makes hell of a difference.
Now, if you are making an investment and making monthly payments, you will be getting
annual return of 12.68% against 12% if you make yearly payment.
And you need to produce abbreviations or acronyms for them like below in all capitals
Smith Johnson - SJ
Liz lotte - LT
Christy tiara Lewisk - CTL
john - J
Then you can use following formula for the same for upto 3 words in the name -
© eforexcel.com Page 27 of 38
Excel Formulas Bible
=UPPER(TRIM(LEFT(A1,1)&MID(A1,FIND(" ",A1&"
")+1,1)&MID(A1,FIND("*",SUBSTITUTE(A1&" "," ","*",2))+1,1)))
=UPPER(TRIM(LEFT(A1,1)&IFERROR(MID(A1,FIND("
",A1)+1,1),"")&IFERROR(MID(A1,FIND("*",SUBSTITUTE(A1," ","*",2))+1,1),"")))
Note - This technique can be used to extend up to many words. Only change will be in last
block where you can replace 2 with 3, 4,5 and so on in
IFERROR(MID(A1,FIND("*",SUBSTITUTE(A1," ","*",2))+1,1),"") for 4th, 5th, 6th words and
concatenate them....Hence for upto 6 words, the formula would become
=UPPER(TRIM(LEFT(A1,1)&IFERROR(MID(A1,FIND("
",A1)+1,1),"")&IFERROR(MID(A1,FIND("*",SUBSTITUTE(A1," ","*",2))+1,1),"")
&IFERROR(MID(A1,FIND("*",SUBSTITUTE(A1,"
","*",3))+1,1),"")&IFERROR(MID(A1,FIND("*",SUBSTITUTE(A1," ","*",4))+1,1),"")
&IFERROR(MID(A1,FIND("*",SUBSTITUTE(A1," ","*",5))+1,1),"")))
=SUBSTITUTE(ADDRESS(1,A1,4),1,"")
© eforexcel.com Page 28 of 38
Excel Formulas Bible
=SUBSTITUTE(ADDRESS(1,A1,4)&":"&ADDRESS(1,A1,4),1,"")
Now, you give =LARGE(A1:A10,3) and now the result is 24. The reason is that large function
gives the nth largest value in a sorted array. Hence, LARGE function will sort the above array
as {24,24,24,22,22,18,18,9} and 3rd largest is 24.
But actually you want the unique 3rd largest which is 18 as the answer.
© eforexcel.com Page 29 of 38
Excel Formulas Bible
=LARGE(IF(FREQUENCY($A$2:$A$10,$A$2:$A$10)<>0,$A$2:$A$10),3)
To extract date, use following formula and format the result cell as date
= INT(A1)
To extract time, use following formula and format the result cell as time
= MOD(A1,1)
Now, an user can become more demanding and he can say that if month is less than 12, then
Years should not be displayed. For example, he might say that 8 should be converted to 8
Months and it should not be shown as 0 Years and 8 Months.
Now, user can ask more. He can say when I give 12, it displays as 1 Years and 0 Months and
he simply wants to see 1 Years only. And for 36, he wants to see only 3 Years not 3 Years 0
Months. In this case, formula will have to be tweaked more. Now, the formula becomes -
Now an user can come and can ask for one last thing. He can say that if this is 1 Year or 1
Month, it should not be displayed as Years or Months as 1 is not plural. Hence, 25 should be
displayed as 2 Years and 1 Month not as 2 Years and 1 Months. Hence, 18 should not be
displayed as 1 Years and 6 Months but as 1 Year and 6 Months. Similarly 13 should be
displayed as 1 Year and 1 Month not as 1 Years and 1 Months.
© eforexcel.com Page 30 of 38
Excel Formulas Bible
A possible solution is
=(A3>5)+(A8>5)
What happens if you need to do for A3, A4, A5, A8, A24, A40, A45, A89. Now, you will have
to use a formula like -
=(A3>5)+(A4>5)+(A5>5)+(A8>5)+(A24>5)+(A40>5)+(A45>5)+(A89>5)
The formula becomes cumbersome as the number of cells increase. In this case, you can use
below formula. This single formula can take care of contiguous (like A3:A5) and non-
contiguous ranges both -
=SUM(COUNTIF(INDIRECT({"A3:A5","A8","A24","A40","A45","A89"}),">5"))
=LEN(TRIM(A1))-LEN(SUBSTITUTE(TRIM(A1)," ",""))+(TRIM(A1)<>"")
=SUMPRODUCT(LEN(TRIM(A1:A100))-LEN(SUBSTITUTE(TRIM(A1:A100),"
",""))+(TRIM(A1:A100)<>""))
© eforexcel.com Page 31 of 38
Excel Formulas Bible
72. Numerology Sum of the Digits aka Sum the Digits till
the result is a single digit
In Numerology, it is often a task to add the digits till the result is a single digit. For example,
74 = 7 + 4 = 11 = 1 + 1 = 2
23 = 2 + 3 = 5
78 = 7 + 8 = 15 = 1 + 5 = 6
1234567 = 1 + 2 + 3 + 4 + 5 + 6 + 7 = 28 = 2+ 8 = 10 = 1+ 0 = 1
=MOD(A1-1,9)+1
For example -
1,2,3,4,1,2,3,4,1,2,3,4
=MOD(ROWS($1:1)-1,4)+1
Replace 4 with with any other number to generate any other sequence. Hence, if you want
to generate 1,2,3,4,5,6,7,8,9,10,1,2,3,4,5,6,7,8,9,10,1,2,3,4,5,6,7,8,9,10 then formula
becomes -
=MOD(ROWS($1:1)-1,10)+1
=MOD(ROWS($1:1)-1,X)+Y
X - Number of numbers
Y - Starting Number
=MOD(ROWS($1:1)-1,6)+5
© eforexcel.com Page 32 of 38
Excel Formulas Bible
=ROUNDUP(ROWS($1:1)/4,0)
Suppose, you want to start the number with 5 not 1, then you can use below formula -
=ROUNDUP(ROWS($1:1)/4,0)+4
=ROUNDUP(ROWS($1:1)/X,0)+Y-1
Hence, if you want to start with number 7 and you want to repeat it 5 times, then following
formula should be used
=ROUNDUP(ROWS($1:1)/5,0)+6
=IFERROR(AGGREGATE(14,6,ROW($1:$30)*NOT(COUNTIF($A$1:$A1, ROW($1:$30))),
RANDBETWEEN(1,30-ROWS($1:1)+1)),"")
Note: $A$1:$A1 is with reference to A2 as you put formula in A2 and dragged down.
Suppose, you had put the formula in G4, this should be replaced with $G$3:$G3.
If your starting and ending numbers are in B1 and C1, use below formula
=IFERROR(AGGREGATE(14,6,ROW(INDIRECT($B$1&":"&$C$1))*
NOT(COUNTIF($A$1:$A1,ROW(INDIRECT($B$1&":"&$C$1)))),
RANDBETWEEN($B$1,$C$1-ROWS($1:1)+1)),"")
For versions, prior to 2010 following basic construct can be used (Build error handling
depending upon the version. For example, Excel 2007 will support IFERROR whereas 2003
supports ISERROR) -
=LARGE(INDEX(ROW($1:$30)*NOT(COUNTIF($A$1:$A1, ROW($1:$30))),,),
RANDBETWEEN(1,30-ROW(A1)+1))
© eforexcel.com Page 33 of 38
Excel Formulas Bible
Now if a date is given, then following formula can be used to derive 2015-16 kind of result.
=YEAR(A1)-(MONTH(A1)<=3)&"-"&YEAR(A1)+(MONTH(A1)>3)
="FY"&RIGHT(YEAR(A1)+(MONTH(A1)>3),2)
=WORKDAY(EOMONTH("1JAN"&A1,-1),1)
The above formula assumes that your weekends are Saturday and Sunday.
But, if your weekends are different (e.g. in gulf countries), you can use following formula -
=WORKDAY.INTL(EOMONTH("1JAN"&A1,-1),1,"0000110")
Where 0000110 is a 7 character string, 1 represents a weekend and 0 is a working day. First
digit is Monday and last digit is Sunday. The above example is for Gulf countries where
Friday and Saturday are weekends.
You also have option to give a range which has holidays. In that case, your formula would
become
=WORKDAY(EOMONTH("1JAN"&A1,-1),1,D1:D10)
=WORKDAY.INTL(EOMONTH("1JAN"&A1,-1),1,"0000110",D1:D10)
=WORKDAY("1JAN"&A1+1,-1)
The above formula assumes that your weekends are Saturday and Sunday.
But, if your weekends are different (e.g. in gulf countries), you can use following formula -
© eforexcel.com Page 34 of 38
Excel Formulas Bible
=WORKDAY.INTL("1JAN"&A1+1,-1,"0000110")
Where 0000110 is a 7 character string, 1 represents a weekend and 0 is a working day. First
digit is Monday and last digit is Sunday. The above example is for Gulf countries where
Friday and Saturday are weekends.
You also have option to give a range which has holidays. In that case, your formula would
become
=WORKDAY("1JAN"&A1+1,-1,D1:D10)
=WORKDAY.INTL("1JAN"&A1+1,-1,"0000110",D1:D10)
Where range D1:D10 contains the list of holidays.
=TEXT(A1,"yyyy")&TEXT(A1-("1JAN"&YEAR(A1))+1,"000")
=TEXT(A1,"yy")&TEXT(A1-("1JAN"&YEAR(A1))+1,"000")
=DATE(LEFT(A1,4),1,RIGHT(A1,3))
For 5 Digits Julian Dates, following formula should be used depending upon which century
(Note - Julian dates are most likely to fall into 20th Century)
21st Century
=DATE(20&LEFT(A1,2),1,RIGHT(A1,3))
20th Century
=DATE(19&LEFT(A1,2),1,RIGHT(A1,3))
© eforexcel.com Page 35 of 38
Excel Formulas Bible
=IFERROR(LEFT(A1,SEARCH("@",A1)-1),"")
=REPLACE(A1,1,SEARCH("@",A1)+1,"")
=IFERROR(AGGREGATE(15,6,FIND({1,2,3,4,5,6,7,8,9,0},A1,ROW(INDIRECT("1:"&LEN(A1)
))),1),"")
=IFERROR(AGGREGATE(14,6,FIND({1,2,3,4,5,6,7,8,9,0},A1,ROW(INDIRECT("1:"&LEN(A1)
))),1),"")
© eforexcel.com Page 36 of 38
Excel Formulas Bible
91. MAXIF
Note – Excel 2016 has introduced MAXIFS function
Suppose you want to find the Maximum Sales for East Region i.e. MAXIF
=SUMPRODUCT(MAX((A2:A100="East")*(B2:B100)))
=AGGREGATE(14,6,($A$2:$A$100="East")*($B$2:$B$100),1)
92. MINIF
Note – Excel 2016 has introduced MINIFS function
Suppose you want to find the Minimum Sales for West Region i.e. MINIF
=AGGREGATE(15,6,1/($A$2:$A$10="West")*($B$2:$B$10),1)
But the above formula will not ignore blanks or 0 values in your range. If you want to ignore
0 values /blanks, in your range, then use following formula
© eforexcel.com Page 37 of 38
Excel Formulas Bible
=AGGREGATE(15,6,1/(($A$2:$A$10="West")*($B$2:$B$10<>0))*($B$2:$B$10),1)
=IFERROR(INDEX($A$2:$A$100,MATCH(0,INDEX(COUNTIF($C$1:$C1,$A$2:$A$100),0,0),
)),"")
Case 2 – A2:A100 contains blanks. In this case, you will have to use Array formula.
OR
=IFERROR(INDEX($A$2:$A$100,MATCH(0,COUNTIF($C$1:$C1,$A$2:$A$100&""),0)),"")
Note - Array Formula is not entered by pressing ENTER after entering your formula but by
pressing CTRL+SHIFT+ENTER. If you are copying and pasting this formula, take F2 after
pasting and CTRL+SHIFT+ENTER. This will put { } brackets around the formula which you
can see in Formula Bar. If you edit again, you will have to do CTRL+SHIFT+ENTER again.
Don't put { } manually.
© eforexcel.com Page 38 of 38