You are on page 1of 28

The most current version of this document (and many other references) can be found at NeatInfo.

com/dev_notes/_cheat-sheets by Jan Zumwalt - NeatInfo.com

NeatInfo.com - by Jan Zumwalt EXCEL Reference

Page 1 of 28

May 20, 2012 Copyright 1995-2012

Note: ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________
NeatInfo.com - by Jan Zumwalt EXCEL Reference Page 2 of 28 May 20, 2012 Copyright 1995-2012

Table of Contents
Database functions .........................................................................................................................5 Date and time functions ..................................................................................................................5 Engineering functions .....................................................................................................................5 Financial functions ..........................................................................................................................6 Information functions .....................................................................................................................7 Logical functions .............................................................................................................................7 Lookup and reference functions ......................................................................................................8 Math and trigonometry functions ...................................................................................................8 Statistical functions.........................................................................................................................9 Text functions ............................................................................................................................... 11 External functions ......................................................................................................................... 11 Code Snippets ............................................................................................................................... 12
Array To Column ............................................................................................................................................... 12 Averaging Values In A Range ............................................................................................................................. 12 Counting Values Between Two Numbers.......................................................................................................... 12 Counting Characters In A String ........................................................................................................................ 12 Date And Time Formulas ................................................................................................................................... 12 Duplicate And Unique Values In A Range ......................................................................................................... 13 Dynamic Ranges ................................................................................................................................................ 13 Finding The Used Part Of A Range .................................................................................................................... 13 First And Last Names ......................................................................................................................................... 14 Returning First Word In A String ...................................................................................................................... 14 Returning Last Word In A String ........................................................................................................................ 14 Returning All But First Word In A String ............................................................................................................ 14 Returning Any Word Or Words In A String ....................................................................................................... 14 Grades ............................................................................................................................................................... 15 High And Low Values ......................................................................................................................................... 15 Left Lookups ...................................................................................................................................................... 15 Minimum And Maximum Values In A Range .................................................................................................... 16 Most Common String In A Range ...................................................................................................................... 16 Ranking Numbers .............................................................................................................................................. 17 Removing Blank Cells In A Range ...................................................................................................................... 17 Summing Every Nth Value ................................................................................................................................. 17
NeatInfo.com - by Jan Zumwalt EXCEL Reference Page 3 of 28 May 20, 2012 Copyright 1995-2012

Miscellaneous ............................................................................................................................... 18
Sheet Name ....................................................................................................................................................... 18 File Name .......................................................................................................................................................... 18

Function Cheat Sheet .................................................................................................................... 19 Logical Functions........................................................................................................................... 21 User Defined Functions ................................................................................................................. 22 Visual Basic ................................................................................................................................... 24 Back Page ..................................................................................................................................... 28
Documentation ................................................................................................................................................. 28 TutoriaLs ................................................................................................................Error! Bookmark not defined. References......................................................................................................................................................... 28

NeatInfo.com - by Jan Zumwalt EXCEL Reference

Page 4 of 28

May 20, 2012 Copyright 1995-2012

Database functions
Function Description DAVERAGE Returns the average of selected database entries DCOUNT Counts the cells that contain numbers in a database DCOUNTA Counts nonblank cells in a database DGET Extracts from a database a single record that matches the specified criteria DMAX Returns the maximum value from selected database entries DMIN Returns the minimum value from selected database entries DPRODUCTMultiplies the values in a particular field of records that match the criteria in a database DSTDEV Estimates the standard deviation based on a sample of selected database entries DSTDEVP Calculates the standard deviation based on the entire population of selected database entries DSUM Adds the numbers in the field column of records in the database that match the criteria DVAR Estimates variance based on a sample from selected database entries DVARP Calculates variance based on the entire population of selected database entries

Date and time functions


Function DATE DATEVALUE DAY DAYS360 EDATE Description Returns the serial number of a particular date Converts a date in the form of text to a serial number Converts a serial number to a day of the month Calculates the number of days between two dates based on a 360-day year Returns the serial number of the date that is the indicated number of months before or after the start date EOMONTH Returns the serial number of the last day of the month before or after a specified number of months HOUR Converts a serial number to an hour MINUTE Converts a serial number to a minute MONTH Converts a serial number to a month NETWORKDAYSReturns the number of whole workdays between two dates NOW Returns the serial number of the current date and time SECOND Converts a serial number to a second TIME Returns the serial number of a particular time TIMEVALUE Converts a time in the form of text to a serial number TODAY Returns the serial number of today's date WEEKDAY Converts a serial number to a day of the week WEEKNUM Converts a serial number to a number representing where the week falls numerically with a year WORKDAY Returns the serial number of the date before or after a specified number of workdays YEAR Converts a serial number to a year YEARFRAC Returns the year fraction representing the number of whole days between start_date and end_date

Engineering functions
Function BESSELI BESSELJ BESSELK BESSELY BIN2DEC BIN2HEX BIN2OCT COMPLEX CONVERT DEC2BIN DEC2HEX DEC2OCT DELTA Description Returns the modified Bessel function In(x) Returns the Bessel function Jn(x) Returns the modified Bessel function Kn(x) Returns the Bessel function Yn(x) Converts a binary number to decimal Converts a binary number to hexadecimal Converts a binary number to octal Converts real and imaginary coefficients into a complex number Converts a number from one measurement system to another Converts a decimal number to binary Converts a decimal number to hexadecimal Converts a decimal number to octal Tests whether two values are equal
Page 5 of 28 May 20, 2012 Copyright 1995-2012

NeatInfo.com - by Jan Zumwalt EXCEL Reference

ERF Returns the error function ERFC Returns the complementary error function GESTEP Tests whether a number is greater than a threshold value HEX2BIN Converts a hexadecimal number to binary HEX2DEC Converts a hexadecimal number to decimal HEX2OCT Converts a hexadecimal number to octal IMABS Returns the absolute value (modulus) of a complex number IMAGINARY Returns the imaginary coefficient of a complex number IMARGUMENT Returns the argument theta, an angle expressed in radians IMCONJUGATEReturns the complex conjugate of a complex number IMCOS Returns the cosine of a complex number IMDIV Returns the quotient of two complex numbers IMEXP Returns the exponential of a complex number IMLN Returns the natural logarithm of a complex number IMLOG10 Returns the base-10 logarithm of a complex number IMLOG2 Returns the base-2 logarithm of a complex number IMPOWER Returns a complex number raised to an integer power IMPRODUCT Returns the product of from 2 to 29 complex numbers IMREAL Returns the real coefficient of a complex number IMSIN Returns the sine of a complex number IMSQRT Returns the square root of a complex number IMSUB Returns the difference between two complex numbers IMSUM Returns the sum of complex numbers OCT2BIN Converts an octal number to binary OCT2DEC Converts an octal number to decimal OCT2HEX Converts an octal number to hexadecimal

Financial functions
Function Description ACCRINT Returns the accrued interest for a security that pays periodic interest ACCRINTM Returns the accrued interest for a security that pays interest at maturity AMORDEGRC Returns the depreciation for each accounting period by using a depreciation coefficient AMORLINC Returns the depreciation for each accounting period COUPDAYBS Returns the number of days from the beginning of the coupon period to the settlement date COUPDAYS Returns the number of days in the coupon period that contains the settlement date COUPDAYSNCReturns the number of days from the settlement date to the next coupon date COUPNCD Returns the next coupon date after the settlement date COUPNUM Returns the number of coupons payable between the settlement date and maturity date COUPPCD Returns the previous coupon date before the settlement date CUMIPMT Returns the cumulative interest paid between two periods CUMPRINC Returns the cumulative principal paid on a loan between two periods DB Returns the depreciation of an asset for a specified period by using the fixed-declining balance method DDB Returns the depreciation of an asset for a specified period by using the double-declining balance method or some other method that you specify DISC Returns the discount rate for a security DOLLARDE Converts a dollar price, expressed as a fraction, into a dollar price, expressed as a decimal number DOLLARFR Converts a dollar price, expressed as a decimal number, into a dollar price, expressed as a fraction DURATION Returns the annual duration of a security with periodic interest payments EFFECT Returns the effective annual interest rate FV Returns the future value of an investment FVSCHEDULE Returns the future value of an initial principal after applying a series of compound interest rates INTRATE Returns the interest rate for a fully invested security IPMT Returns the interest payment for an investment for a given period IRR Returns the internal rate of return for a series of cash flows ISPMT Calculates the interest paid during a specific period of an investment MDURATION Returns the Macauley modified duration for a security with an assumed par value of $100
NeatInfo.com - by Jan Zumwalt EXCEL Reference Page 6 of 28 May 20, 2012 Copyright 1995-2012

MIRR NOMINAL NPER NPV ODDFPRICE ODDFYIELD ODDLPRICE ODDLYIELD PMT PPMT PRICE PRICEDISC PRICEMAT PV RATE RECEIVED SLN SYD TBILLEQ TBILLPRICE TBILLYIELD VDB XIRR XNPV YIELD YIELDDISC YIELDMAT

Returns the internal rate of return where positive and negative cash flows are financed at different rates Returns the annual nominal interest rate Returns the number of periods for an investment Returns the net present value of an investment based on a series of periodic cash flows and a discount rate Returns the price per $100 face value of a security with an odd first period Returns the yield of a security with an odd first period Returns the price per $100 face value of a security with an odd last period Returns the yield of a security with an odd last period Returns the periodic payment for an annuity Returns the payment on the principal for an investment for a given period Returns the price per $100 face value of a security that pays periodic interest Returns the price per $100 face value of a discounted security Returns the price per $100 face value of a security that pays interest at maturity Returns the present value of an investment Returns the interest rate per period of an annuity Returns the amount received at maturity for a fully invested security Returns the straight-line depreciation of an asset for one period Returns the sum-of-years' digits depreciation of an asset for a specified period Returns the bond-equivalent yield for a Treasury bill Returns the price per $100 face value for a Treasury bill Returns the yield for a Treasury bill Returns the depreciation of an asset for a specified or partial period by using a declining balance method Returns the internal rate of return for a schedule of cash flows that is not necessarily periodic Returns the net present value for a schedule of cash flows that is not necessarily periodic Returns the yield on a security that pays periodic interest Returns the annual yield for a discounted security; for example, a Treasury bill Returns the annual yield of a security that pays interest at maturity

Information functions
Function Description CELL Returns information about the formatting, location, or contents of a cell ERROR.TYPEReturns a number corresponding to an error type INFO Returns information about the current operating environment ISBLANK Returns TRUE if the value is blank ISERR Returns TRUE if the value is any error value except #N/A ISERROR Returns TRUE if the value is any error value ISEVEN Returns TRUE if the number is even ISLOGICAL Returns TRUE if the value is a logical value ISNA Returns TRUE if the value is the #N/A error value ISNONTEXT Returns TRUE if the value is not text ISNUMBER Returns TRUE if the value is a number ISODD Returns TRUE if the number is odd ISREF Returns TRUE if the value is a reference ISTEXT Returns TRUE if the value is text N Returns a value converted to a number NA Returns the error value #N/A TYPE Returns a number indicating the data type of a value

Logical functions
Function AND FALSE IF NOT Description Returns TRUE if all of its arguments are TRUE Returns the logical value FALSE Specifies a logical test to perform Reverses the logic of its argument
Page 7 of 28 May 20, 2012 Copyright 1995-2012

NeatInfo.com - by Jan Zumwalt EXCEL Reference

OR TRUE

Returns TRUE if any argument is TRUE Returns the logical value TRUE

Lookup and reference functions


Function Description ADDRESS Returns a reference as text to a single cell in a worksheet AREAS Returns the number of areas in a reference CHOOSE Chooses a value from a list of values COLUMN Returns the column number of a reference COLUMNS Returns the number of columns in a reference GETPIVOTDATAReturns data stored in a PivotTable HLOOKUP Looks in the top row of an array and returns the value of the indicated cell HYPERLINK Creates a shortcut or jump that opens a document stored on a network server, an intranet, or the Internet INDEX Uses an index to choose a value from a reference or array INDIRECT Returns a reference indicated by a text value LOOKUP Looks up values in a vector or array MATCH Looks up values in a reference or array OFFSET Returns a reference offset from a given reference ROW Returns the row number of a reference ROWS Returns the number of rows in a reference RTD Retrieves real-time data from a program that supports COM automation (Automation: A way to work with an application's objects from another application or development tool. Formerly called OLE Automation, Automation is an industry standard and a feature of the Component Object Model (COM).) TRANSPOSE Returns the transpose of an array VLOOKUP Looks in the first column of an array and moves across the row to return the value of a cell

Math and trigonometry functions


Function ABS ACOS ACOSH ASIN ASINH ATAN ATAN2 ATANH CEILING COMBIN COS COSH DEGREES EVEN EXP FACT FACTDOUBLE FLOOR GCD INT LCM LN LOG LOG10 MDETERM MINVERSE MMULT Description Returns the absolute value of a number Returns the arccosine of a number Returns the inverse hyperbolic cosine of a number Returns the arcsine of a number Returns the inverse hyperbolic sine of a number Returns the arctangent of a number Returns the arctangent from x- and y-coordinates Returns the inverse hyperbolic tangent of a number Rounds a number to the nearest integer or to the nearest multiple of significance Returns the number of combinations for a given number of objects Returns the cosine of a number Returns the hyperbolic cosine of a number Converts radians to degrees Rounds a number up to the nearest even integer Returns e raised to the power of a given number Returns the factorial of a number Returns the double factorial of a number Rounds a number down, toward zero Returns the greatest common divisor Rounds a number down to the nearest integer Returns the least common multiple Returns the natural logarithm of a number Returns the logarithm of a number to a specified base Returns the base-10 logarithm of a number Returns the matrix determinant of an array Returns the matrix inverse of an array Returns the matrix product of two arrays
Page 8 of 28 May 20, 2012 Copyright 1995-2012

NeatInfo.com - by Jan Zumwalt EXCEL Reference

MOD Returns the remainder from division MROUND Returns a number rounded to the desired multiple MULTINOMIAL Returns the multinomial of a set of numbers ODD Rounds a number up to the nearest odd integer PI Returns the value of pi POWER Returns the result of a number raised to a power PRODUCT Multiplies its arguments QUOTIENT Returns the integer portion of a division RADIANS Converts degrees to radians RAND Returns a random number between 0 and 1 RANDBETWEENReturns a random number between the numbers you specify ROMAN Converts an arabic numeral to roman, as text ROUND Rounds a number to a specified number of digits ROUNDDOWN Rounds a number down, toward zero ROUNDUP Rounds a number up, away from zero SERIESSUM Returns the sum of a power series based on the formula SIGN Returns the sign of a number SIN Returns the sine of the given angle SINH Returns the hyperbolic sine of a number SQRT Returns a positive square root SQRTPI Returns the square root of (number * pi) SUBTOTAL Returns a subtotal in a list or database SUM Adds its arguments SUMIF Adds the cells specified by a given criteria SUMPRODUCT Returns the sum of the products of corresponding array components SUMSQ Returns the sum of the squares of the arguments SUMX2MY2 Returns the sum of the difference of squares of corresponding values in two arrays SUMX2PY2 Returns the sum of the sum of squares of corresponding values in two arrays SUMXMY2 Returns the sum of squares of differences of corresponding values in two arrays TAN Returns the tangent of a number TANH Returns the hyperbolic tangent of a number TRUNC Truncates a number to an integer

Statistical functions
Function AVEDEV AVERAGE AVERAGEA BETADIST BETAINV BINOMDIST CHIDIST CHIINV CHITEST CONFIDENCE CORREL COUNT COUNTA COUNTBLANK COUNTIF COVAR CRITBINOM DEVSQ EXPONDIST FDIST FINV FISHER FISHERINV Description Returns the average of the absolute deviations of data points from their mean Returns the average of its arguments Returns the average of its arguments, including numbers, text, and logical values Returns the beta cumulative distribution function Returns the inverse of the cumulative distribution function for a specified beta distribution Returns the individual term binomial distribution probability Returns the one-tailed probability of the chi-squared distribution Returns the inverse of the one-tailed probability of the chi-squared distribution Returns the test for independence Returns the confidence interval for a population mean Returns the correlation coefficient between two data sets Counts how many numbers are in the list of arguments Counts how many values are in the list of arguments Counts the number of blank cells within a range Counts the number of nonblank cells within a range that meet the given criteria Returns covariance, the average of the products of paired deviations Returns the smallest value for which the cumulative binomial distribution is less than or equal to a criterion value Returns the sum of squares of deviations Returns the exponential distribution Returns the F probability distribution Returns the inverse of the F probability distribution Returns the Fisher transformation Returns the inverse of the Fisher transformation
Page 9 of 28 May 20, 2012 Copyright 1995-2012

NeatInfo.com - by Jan Zumwalt EXCEL Reference

FORECAST Returns a value along a linear trend FREQUENCY Returns a frequency distribution as a vertical array FTEST Returns the result of an F-test GAMMADIST Returns the gamma distribution GAMMAINV Returns the inverse of the gamma cumulative distribution GAMMALN Returns the natural logarithm of the gamma function, (x) GEOMEAN Returns the geometric mean GROWTH Returns values along an exponential trend HARMEAN Returns the harmonic mean HYPGEOMDIST Returns the hypergeometric distribution INTERCEPT Returns the intercept of the linear regression line KURT Returns the kurtosis of a data set LARGE Returns the k-th largest value in a data set LINEST Returns the parameters of a linear trend LOGEST Returns the parameters of an exponential trend LOGINV Returns the inverse of the lognormal distribution LOGNORMDIST Returns the cumulative lognormal distribution MAX Returns the maximum value in a list of arguments MAXA Returns the maximum value in a list of arguments, including numbers, text, and logical values MEDIAN Returns the median of the given numbers MIN Returns the minimum value in a list of arguments MINA Returns the smallest value in a list of arguments, including numbers, text, and logical values MODE Returns the most common value in a data set NEGBINOMDISTReturns the negative binomial distribution NORMDIST Returns the normal cumulative distribution NORMINV Returns the inverse of the normal cumulative distribution NORMSDIST Returns the standard normal cumulative distribution NORMSINV Returns the inverse of the standard normal cumulative distribution PEARSON Returns the Pearson product moment correlation coefficient PERCENTILE Returns the k-th percentile of values in a range PERCENTRANK Returns the percentage rank of a value in a data set PERMUT Returns the number of permutations for a given number of objects POISSON Returns the Poisson distribution PROB Returns the probability that values in a range are between two limits QUARTILE Returns the quartile of a data set RANK Returns the rank of a number in a list of numbers RSQ Returns the square of the Pearson product moment correlation coefficient SKEW Returns the skewness of a distribution SLOPE Returns the slope of the linear regression line SMALL Returns the k-th smallest value in a data set STANDARDIZE Returns a normalized value STDEV Estimates standard deviation based on a sample STDEVA Estimates standard deviation based on a sample, including numbers, text, and logical values STDEVP Calculates standard deviation based on the entire population STDEVPA Calculates standard deviation based on the entire population, including numbers, text, and logical values STEYX Returns the standard error of the predicted y-value for each x in the regression TDIST Returns the Student's t-distribution TINV Returns the inverse of the Student's t-distribution TREND Returns values along a linear trend TRIMMEAN Returns the mean of the interior of a data set TTEST Returns the probability associated with a Student's t-test VAR Estimates variance based on a sample VARA Estimates variance based on a sample, including numbers, text, and logical values VARP Calculates variance based on the entire population VARPA Calculates variance based on the entire population, including numbers, text, and logical values WEIBULL Returns the Weibull distribution ZTEST Returns the one-tailed probability-value of a z-test

NeatInfo.com - by Jan Zumwalt EXCEL Reference

Page 10 of 28

May 20, 2012 Copyright 1995-2012

Text functions
Function ASC BAHTTEXT CHAR CLEAN CODE CONCATENATE DOLLAR EXACT FIND, FINDB FIXED JIS LEFT, LEFTB LEN, LENB LOWER MID, MIDB PHONETIC PROPER REPLACE, REPLACEB REPT RIGHT, RIGHTB SEARCH, SEARCHB SUBSTITUTE T TEXT TRIM UPPER VALUE Description Changes full-width (double-byte) English letters or katakana within a character string to half-width (single-byte) characters Converts a number to text, using the (baht) currency format Returns the character specified by the code number Removes all nonprintable characters from text Returns a numeric code for the first character in a text string Joins several text items into one text item Converts a number to text, using the $ (dollar) currency format Checks to see if two text values are identical Finds one text value within another (case-sensitive) Formats a number as text with a fixed number of decimals Changes half-width (single-byte) English letters or katakana within a character string to fullwidth (double-byte) characters Returns the leftmost characters from a text value Returns the number of characters in a text string Converts text to lowercase Returns a specific number of characters from a text string starting at the position you specify Extracts the phonetic (furigana) characters from a text string Capitalizes the first letter in each word of a text value Replaces characters within text Repeats text a given number of times Returns the rightmost characters from a text value Finds one text value within another (not case-sensitive) Substitutes new text for old text in a text string Converts its arguments to text Formats a number and converts it to text Removes spaces from text Converts text to uppercase Converts a text argument to a number

External functions
Function Description EUROCONVERTConverts a number to euros, converts a number from euros to a euro member currency, or converts a number from one euro member currency to another by using the euro as an intermediary (triangulation) SQL.REQUEST Connects with an external data source and runs a query from a worksheet, then returns the result as an array without the need for macro programming

NeatInfo.com - by Jan Zumwalt EXCEL Reference

Page 11 of 28

May 20, 2012 Copyright 1995-2012

Code Snippets
Array To Column
Sometimes it is useful to convert an MxN array into a single column of data, for example for charting (a data series must be a single row or column). Click here for more details.

Averaging Values In A Range


You can use Excel's built in =AVERAGE function to average a range of values. By using it with other functions, you can extend its functionality. For the formulas given below, assume that our data is in the range A1:A60. In all of the formulas you can use =SUM instead of =AVERAGE to sum, rather than average, the numbers. Averaging Values Between Two Numbers Use the array formula =AVERAGE(IF((A1:A60>=Low)*(A1:A60<=High),A1:A60)) Where Low and High are the values between which you want to average. Averaging The Highest N Numbers In A Range To average the N largest numbers in a range, use the array formula =AVERAGE(LARGE(A1:A60,ROW(INDIRECT("1:10")))) Change "1:10" to "1:N" where N is the number of values to average. Averaging The Lowest N Numbers In A Range To average the N smallest numbers in a range, use the array formula =AVERAGE(SMALL(A1:A60,ROW(INDIRECT("1:10")))) Change "1:10" to "1:N" where N is the number of values to average.

Counting Values Between Two Numbers


If you need to count the values in a range that are between two numbers, for example between 5 and 10, use the following array formula: =SUM((A1:A10>=5)*(A1:A10<=10)) To sum the same numbers, use the following array formula: =SUM((A1:A10>=5)*(A1:A10<=10)*A1:A10)

Counting Characters In A String


The following formula will count the number of "B"s, both upper and lower case, in the string in B1. =LEN(B1)-LEN(SUBSTITUTE(SUBSTITUTE(B1,"B",""),"b",""))

Date And Time Formulas


A variety of formulas useful when working with dates and times are described on the DateTime page. Other Date Related Procedures are described on the following pages.
NeatInfo.com - by Jan Zumwalt EXCEL Reference Page 12 of 28 May 20, 2012 Copyright 1995-2012

Adding Months And Years The DATEDIF Function Date Intervals Dates And Times Date And Time Entry Holidays Julian Dates

Duplicate And Unique Values In A Range


The task of finding duplicate or unique values in a range of data requires some complicated formulas. These procedures are described in Duplicates.

Dynamic Ranges
You can define a name to refer to a range whose size varies depending on its contents. For example, you may want a range name that refers only to the portion of a list of numbers that are not blank. such as only the first N non-blank cells in A2:A20. Define a name called MyRange, and set the Refers To property to: =OFFSET(Sheet1!$A$2,0,0,COUNTA($A$2:$A$20),1) Be sure to use absolute cell references in the formula. Also see then Named Ranges page for more information about dynamic ranges.

Finding The Used Part Of A Range


Suppose we've got a range of data called DataRange2, defined as H7:I25, and that cells H7:I17 actually contain values. The rest are blank. We can find various properties of the range, as follows: To find the range that contains data, use the following array formula: =ADDRESS(ROW(DataRange2),COLUMN(DataRange2),4)&":"& ADDRESS(MAX((DataRange2<>"")*ROW(DataRange2)),COLUMN(DataRange2)+ COLUMNS(DataRange2)-1,4) This will return the range H7:I17. If you need the worksheet name in the returned range, use the following array formula: =ADDRESS(ROW(DataRange2),COLUMN(DataRange2),4,,"MySheet")&":"& ADDRESS(MAX((DataRange2<>"")*ROW(DataRange2)),COLUMN(DataRange2)+ COLUMNS(DataRange2)-1,4) This will return MySheet!H7:I17. To find the number of rows that contain data, use the following array formula: =(MAX((DataRange2<>"")*ROW(DataRange2)))-ROW(DataRange2)+1 This will return the number 11, indicating that the first 11 rows of DataRange2 contain data. To find the last entry in the first column of DataRange2, use the following array formula: =INDIRECT(ADDRESS(MAX((DataRange2<>"")*ROW(DataRange2)),
NeatInfo.com - by Jan Zumwalt EXCEL Reference Page 13 of 28 May 20, 2012 Copyright 1995-2012

COLUMN(DataRange2),4)) To find the last entry in the second column of DataRange2, use the following array formula: =INDIRECT(ADDRESS(MAX((DataRange2<>"")*ROW(DataRange2)), COLUMN(DataRange2)+1,4))

First And Last Names


Suppose you've got a range of data consisting of people's first and last names. There are several formulas that will break the names apart into first and last names separately. Suppose cell A2 contains the name "John A Smith". To return the last name, use =RIGHT(A2,LEN(A2)-FIND("*",SUBSTITUTE(A2," ","*",LEN(A2)LEN(SUBSTITUTE(A2," ",""))))) To return the first name, including the middle name (if present), use =LEFT(A2,FIND("*",SUBSTITUTE(A2," ","*",LEN(A2)LEN(SUBSTITUTE(A2," ",""))))-1) To return the first name, without the middle name (if present), use =LEFT(B2,FIND(" ",B2,1)) We can extend these ideas to the following. Suppose A1 contains the string "First Second Third Last".

Returning First Word In A String


=LEFT(A1,FIND(" ",A1,1)) This will return the word "First".

Returning Last Word In A String


=RIGHT(A1,LEN(A1)-MAX(ROW(INDIRECT("1:"&LEN(A1))) *(MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1)=" "))) This formula in as array formula. (This formula comes from Laurent Longre). This will return the word "Last"

Returning All But First Word In A String


=RIGHT(A1,LEN(A1)-FIND(" ",A1,1)) This will return the words "Second Third Last"

Returning Any Word Or Words In A String


The following two array formulas come compliments of Laurent Longre. To return any single word from a singlespaced string of words, use the following array formula: =MID(A10,SMALL(IF(MID(" "&A10,ROW(INDIRECT ("1:"&LEN(A10)+1)),1)=" ",ROW(INDIRECT("1:"&LEN(A10)+1))), B10),SUM(SMALL(IF(MID(" "&A10&" ",ROW(INDIRECT ("1:"&LEN(A10)+2)),1)=" ",ROW(INDIRECT("1:"&LEN(A10)+2))),
NeatInfo.com - by Jan Zumwalt EXCEL Reference Page 14 of 28 May 20, 2012 Copyright 1995-2012

B10+{0,1})*{-1,1})-1) Where A10 is the cell containing the text, and B10 is the number of the word you want to get. This formula can be extended to get any set of words in the string. To get the words from M for N words (e.g., the 5th word for 3, or the 5th, 6th, and 7th words), use the following array formula: =MID(A10,SMALL(IF(MID(" "&A10,ROW(INDIRECT ("1:"&LEN(A10)+1)),1)=" ",ROW(INDIRECT("1:"&LEN(A10)+1))), B10),SUM(SMALL(IF(MID(" "&A10&" ",ROW(INDIRECT ("1:"&LEN(A10)+2)),1)=" ",ROW(INDIRECT("1:"&LEN(A10)+2))), B10+C10*{0,1})*{-1,1})-1) Where A10 is the cell containg the text, B10 is the number of the word to get, and C10 is the number of words, starting at B10, to get. Note that in the above array formulas, the {0,1} and {-1,1} are enclosed in array braces (curly brackets {} ) not parentheses. Download a workbook illustrating these formulas.

Grades
A frequent question is how to assign a letter grade to a numeric value. This is simple. First create a define name called "Grades" which refers to the array: ={0,"F";60,"D";70,"C";80,"B";90,"A"} Then, use VLOOKUP to convert the number to the grade: =VLOOKUP(A1,Grades,2) where A1 is the cell contains the numeric value. You can add entries to the Grades array for other grades like C- and C+. Just make sure the numeric values in the array are in increasing order.

High And Low Values


You can use Excel's Circular Reference tool to have a cell that contains the highest ever reached value. For example, suppose you have a worksheet used to track team scores. You can set up a cell that will contain the highest score ever reached, even if that score is deleted from the list. Suppose the score are in A1:A10. First, go to the Tools->Options dialog, click on the Calculation tab, and check the Interations check box. Then, enter the following formula in cell B1: =MAX(A1:A10,B1) Cell B1 will contian the highest value that has ever been present in A1:A10, even if that value is deleted from the range. Use the =MIN function to get the lowest ever value. Another method to do this, without using circular references, is provided by Laurent Longre, and uses the CALL function to access the Excel4 macro function library. Click here for details.

Left Lookups
The easiest way do table lookups is with the =VLOOKUP function. However, =VLOOKUP requires that the value returned be to the right of the value you're looking up. For example, if you're looking up a value in column B, you cannot retrieve values in column A. If you need to retrieve a value in a column to the left of the column containing the lookup value, use either of the following formulas: =INDIRECT(ADDRESS(ROW(Rng)+MATCH(C1,Rng,0)-1,COLUMN(Rng)-ColsToLeft)) Or
NeatInfo.com - by Jan Zumwalt EXCEL Reference Page 15 of 28 May 20, 2012 Copyright 1995-2012

=INDIRECT(ADDRESS(ROW(Rng)+MATCH(C1,Rng,0)-1,COLUMN(A:A) )) Where Rng is the range containing the lookup values, and ColsToLeft is the number of columns to the left of Rng that the retrieval values are. In the second syntax, replace "A:A" with the column containing the retrieval data. In both examples, C1 is the value you want to look up. See the Lookups page for many more examples of lookup formulas.

Minimum And Maximum Values In A Range


Of course you can use the =MIN and =MAX functions to return the minimum and maximum values of a range. Suppose we've got a range of numeric values called NumRange. NumRange may contain duplicate values. The formulas below use the following example: Address Of First Minimum In A Range To return the address of the cell containing the first (or only) instance of the minimum of a list, use the following array formula: =ADDRESS(MIN(IF(NumRange=MIN(NumRange),ROW(NumRange))),COLUMN(NumRange),4) This function returns B2, the address of the first '1' in the range. Address Of The Last Minimum In A Range To return the address of the cell containing the last (or only) instance of the minimum of a list, use the following array formula: =ADDRESS(MAX(IF(NumRange=MIN(NumRange),ROW(NumRange)*(NumRange<>""))), COLUMN(NumRange),4) This function returns B4, the address of the last '1' in the range. Address Of First Maximum In A Range To return the address of the cell containing the first instance of the maximum of a list, use the following array formula: =ADDRESS(MIN(IF(NumRange=MAX(NumRange),ROW(NumRange))),COLUMN(NumRange),4) This function returns B1, the address of the first '5' in the range. Address Of The Last Maximum In A Range To return the address of the cell containing the last instance of the maximum of a list, use the following array formula: =ADDRESS(MAX(IF(NumRange=MAX(NumRange),ROW(NumRange)*(NumRange<>""))), COLUMN(NumRange),4) This function returns B5, the address of the last '5' in the range. Download a workbook illustrating these formulas.

Most Common String In A Range


The following array formula will return the most frequently used entry in a range: =INDEX(Rng,MATCH(MAX(COUNTIF(Rng,Rng)),COUNTIF(Rng,Rng),0))
NeatInfo.com - by Jan Zumwalt EXCEL Reference May 20, 2012 Copyright 1995-2012

Page 16 of 28

Where Rng is the range containing the data.

Ranking Numbers
Often, it is useful to be able to return the N highest or lowest values from a range of data. Suppose we have a range of numeric data called RankRng. Create a range next to RankRng (starting in the same row, with the same number of rows) called TopRng. Also, create a named cell called TopN, and enter into it the number of values you want to return (e.g., 5 for the top 5 values in RankRng). Enter the following formula in the first cell in TopRng, and use Fill Down to fill out the range: =IF(ROW()-ROW(TopRng)+1>TopN,"",LARGE(RankRng,ROW()-ROW(TopRng)+1)) To return the TopN smallest values of RankRng, use =IF(ROW()-ROW(TopRng)+1>TopN,"",SMALL(RankRng,ROW()-ROW(TopRng)+1)) The list of numbers returned by these functions will automatically change as you change the contents of RankRng or TopN. Download a workbook illustrating these formulas. See the Ranking page for much more information about ranking numbers in Excel.

Removing Blank Cells In A Range


The procedures for creating a new list consisting of only those entries in another list, excluding blank cells, are described in NoBlanks.

Summing Every Nth Value


You can easily sum (or average) every Nth cell in a column range. For example, suppose you want to sum every 3rd cell. Suppose your data is in A1:A20, and N = 3 is in D1. The following array formula will sum the values in A3, A6, A9, etc. =SUM(IF(MOD(ROW($A$1:$A$20),$D$1)=0,$A$1:$A$20,0)) If you want to sum the values in A1, A4, A7, etc., use the following array formula: =SUM(IF(MOD(ROW($A$1:$A$20)-1,$D$1)=0,$A$1:$A$20,0)) If your data ranges does not begin in row 1, the formulas are slightly more complicated. Suppose our data is in B3:B22, and N = 3 is in D1. To sum the values in rows 5, 8, 11, etc, use the following array formula: =SUM(IF(MOD(ROW($B$3:$B$22)-ROW($B$3)+1,$D$1)=0,$B$3:B$22,0)) If you want to sum the values in rows 3, 6, 9, etc, use the following array formula: =SUM(IF(MOD(ROW($B$3:$B$22)-ROW($B$3),$D$1)=0,$B$3:B$22,0)) Download a workbook illustrating these formulas.

NeatInfo.com - by Jan Zumwalt EXCEL Reference

Page 17 of 28

May 20, 2012 Copyright 1995-2012

Miscellaneous
Sheet Name
Suppose our active sheet is named "MySheet" in the file C:\Files\MyBook.Xls. To return the full sheet name (including the file path) to a cell, use =CELL("filename",A1) Note that the argument to the =CELL function is the word "filename" in quotes, not your actual filename. This will return "C:\Files\[MyBook.xls]MySheet" To return the sheet name, without the path, use =MID(CELL("filename",A1),FIND("]",CELL("filename",A1))+1, LEN(CELL("filename",A1))-FIND("]",CELL("filename",A1))) This will return "MySheet"

File Name
Suppose our active sheet is named "MySheet" in the file C:\Files\MyBook.Xls. To return the file name without the path, use =MID(CELL("filename",A1),FIND("[",CELL("filename",A1))+1,FIND("]", CELL("filename",A1))-FIND("[",CELL("filename",A1))-1) This will return "MyBook.xls" To return the file name with the path, use either =LEFT(CELL("filename",A1),FIND("]",CELL("filename",A1))) Or =SUBSTITUTE(SUBSTITUTE(LEFT(CELL("filename",A1),FIND("]", CELL("filename",A1))),"[",""),"]","") The first syntax will return "C:\Files\[MyBook.xls]" The second syntax will return "C:\Files\MyBook.xls" In all of the examples above, the A1 argument to the =CELL function forces Excel to get the sheet name from the sheet containing the formula. Without it, and Excel calculates the =CELL function when another sheet is active, the cell would contain the name of the active sheet, not the sheet actually containing the formula.

NeatInfo.com - by Jan Zumwalt EXCEL Reference

Page 18 of 28

May 20, 2012 Copyright 1995-2012

Function Cheat Sheet

NeatInfo.com - by Jan Zumwalt EXCEL Reference

Page 19 of 28

May 20, 2012 Copyright 1995-2012

NeatInfo.com - by Jan Zumwalt EXCEL Reference

Page 20 of 28

May 20, 2012 Copyright 1995-2012

Logical Functions

NeatInfo.com - by Jan Zumwalt EXCEL Reference

Page 21 of 28

May 20, 2012 Copyright 1995-2012

User Defined Functions

NeatInfo.com - by Jan Zumwalt EXCEL Reference

Page 22 of 28

May 20, 2012 Copyright 1995-2012

NeatInfo.com - by Jan Zumwalt EXCEL Reference

Page 23 of 28

May 20, 2012 Copyright 1995-2012

Visual Basic

NeatInfo.com - by Jan Zumwalt EXCEL Reference

Page 24 of 28

May 20, 2012 Copyright 1995-2012

NeatInfo.com - by Jan Zumwalt EXCEL Reference

Page 25 of 28

May 20, 2012 Copyright 1995-2012

Note: ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________
NeatInfo.com - by Jan Zumwalt EXCEL Reference Page 26 of 28 May 20, 2012 Copyright 1995-2012

Note: ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________ ______________________________________________________________
NeatInfo.com - by Jan Zumwalt EXCEL Reference Page 27 of 28 May 20, 2012 Copyright 1995-2012

Back Page

Documentation
None

Tutorials
http://www.baycongroup.com/el0.htm http://people.usd.edu/~bwjames/tut/excel/ http://www.free-training-tutorial.com/ tutorial.com/ http://www.homeandlearn.co.uk/excel2007/Excel2007.html

References
Date & time functions http://office.microsoft.com/en http://office.microsoft.com/en-us/excel-help/CH006252823.aspx help/CH006252823.aspx Charts. http://office.microsoft.com/en http://office.microsoft.com/en-us/excel-help/CH006252806.aspx Working with data, http://office.microsoft.com/en http://office.microsoft.com/en-us/excel-help/CH006252795.aspx help/CH006252795.aspx

NeatInfo.com - by Jan Zumwalt EXCEL Reference

Page 28 of 28

May 20, 2012 Copyright 1995-2012

You might also like