Sie sind auf Seite 1von 27

Is it possible to call a VBA procedure from an Excel 4.0 XLM macro?

Yes, by using XLM's RUN function. For example, the following macro runs the Test
subroutine contained in Module1 in workbook Book1.xls:

=RUN(Book1.xls!Module1.Test)

Can I lock cells such that only specific users can modify them?

Yes, but it requires Excel 2002.

The same is also possible in excel 2003 or excel 2007,There is a option "Allow users to edit
ranges" can be used for this purpose.

How can I prevent a user for adding or deleting sheets?

You need to protect the workbook's structure. Select Tools - Protection - Protect Workbook.
In the Protect Workbook dialog box, make sure that the Structure checkbox is checked. If
you specify a password, that password will be required to unprotect the workbook.

When a workbook's structure is protected, the user may not:

* Add a sheet
* Delete a sheet
* Hide a sheet
* Unhide a sheet
* Rename a sheet
* Move a sheet

Where do I find resources or examples like sales report generation, purchase report
generation using excel.

Press F1, write sales report in search option & view the templates of sales report, but
connection of internet is must.

Ques 04. Difference between ActiveWorkbook and ThisWorkbook.


Solution: ThisWorkbook refers to the workbook where code is being written while ActiveWorkbook
refers to the workbook which is in active state with active window. In case of only one workbook
open, ActiveWorkbook is same as ThisWorkbook.

Ques 05. Code to find a Last used Row in a column or Last used column of a Row.
Solution: Last Row in a column can be find using End(xlUp) and Last Column in a row can be find
using End(xlToLeft). For e.g. Range("A1048576").End(xlUp).Row gives last used row of Column A.

Ques 06. Difference between ActiveX and Form Controls.


Solution:
i) Forms controls can be used on worksheets and chart sheets. Forms controls can also be placed
within embedded charts in Classic Excel (though not in Excel 2007). ActiveX controls can only be
used on worksheets. ActiveX controls do not work in MacExcel.
ii) The Forms controls aren’t very complicated, and they have been part of Excel for longer (they
were used in Excel 5/95’s dialog sheets) than the Controls Toolbox (Excel 97), so it stands to
reason that they’d be more seamlessly integrated. Being newer, the ActiveX controls have richer
formatting possibilities. Both can link to cells and ranges in the worksheet.

Ques 07. What is the difference b/w Functions and Subroutines?


Solution:
i) Subroutines never return a value but functions does return values.
ii) A function could not change the values of actual arguments whereas a subroutine could change
them.

Ques 08. How to debug a VBA code?


Solution: Using Breakpoints(F9), Step-by-step execution (F8), Debug.Print & Immediate Window
and Watch window.

Ques 09. Draw basic Excel Object Model.


Solution: Application --> Workbooks --> Worksheets --> Range / Chart

Ques 11. How to hide a worksheet so that a user cannot unhide it?
Solution: Use Sheet's visible property and set it to xlSheetVeryHidden . For eg. Sheets(1).Visible
= xlSheetVeryHidden will super hide the first worksheet of the workbook.

Ques 12. Union is used for _____________ ?


Solution: To unite the different ranges depending on the logic. It is similar to set union, here
range works as set. For eg. Set nrange = Union(rng1,rng2)

Ques 13. Which are the 2 macro languages and which do you use ?
Solution: XLM (used in Excel 97 or before) and VBA(used for 2000 and after). Obviously, VBA is in
use these days.

Ques 14. Can you lock cells such that only specific users can modify them?
Solution: There is a option "Allow users to edit ranges" can be used for this purpose.

Ques 15. How can you add a drop-down list to a cell so the user can choose a value from the
list?
Solution: Using 'Data Validation'.

Ques 16. How can you increase the number of rows in a worksheet?
Solution: No one can't. They're fixed as 65536(2^16) in Excel 2003 or before and 1048576(2^20) in
Excel 2007 & Excel 2010.

Ques 17. How can you increase the number of columns in a worksheet?
Solution: No one can't. They're fixed as 256(2^8) in Excel 2003 or before and 16384(2^14) in Excel
2007 & Excel 2010.

Ques. 18. How will you distribute a workbook such that it can't be copied using macro or
anything?
Solution: We can create a workbook which cannot be modified but can not create a workbook
which can't be copied.(It depends on system security, it has nothing to do with Excel or VBA)

Ques 19. Your colleague created a dashboard and when you enter a value, it appears with two
decimal places. For example, when you enter 265 it shows up as 2.65. What's wrong?
Solution: By chance Excel's fixed-decimal mode was turned on. To return to normal,
Excel 2003 -->
Click Tools and then Options to display the Options dialog box.
Then click the Edit tab and remove the check mark from the "Fixed decimal " option.
Excel 2007 -->
Click Office button on Top-Left corner and click 'Excel Options'.
Go to Advanced and Uncheck 'Automatically insert a decimal point' option.
Excel 2010 -->
Click File button on Top-Left corner and click 'Excel Options'.
Go to Advanced and Uncheck 'Automatically insert a decimal point' option.

Of course, this feature can be useful when entering some types of data, but most of the time,
you'll want to keep the fixed-decimal mode turned off.

Ques 20. How can you prevent a user for adding or deleting sheets?
Solution: You need to protect the workbook's structure.
Excel 2003 -->
Select Tools - Protection - Protect Workbook. In the Protect Workbook dialog box, make sure that
the Structure checkbox is checked.
Excel 2007/2010 -->
Go to Review --> Click 'Protect Workbook' --> Click 'Protect Structure and Windows'

If you specify a password, that password will be required to unprotect the workbook. When a
workbook's structure is protected, the user may not:
         * Add/Delete a sheet
         * Hide/Unhide a sheet
         * Rename a sheet
         * Move a sheet

Ques 21. What types of workbook protection are available?


Solution: Excel provides three ways to protect a workbook:
         * Require a password to open the workbook
         * Prevent users from adding sheets, deleting sheets, hiding sheets, and unhiding sheets
         * Prevent users from changing the size or position of windows

Ques 22. The Font dialog box allows you to select different Fonts, their style, their size, and
some other special effects. How do you bring up this Font dialog box?
Solution: Use Application.Dialogs(xlDialogFont).Show or
Application.Dialogs(xlDialogFormatFont).Show to load font dialog box from Excel VBA.

Ques 23. What is ADO, OLEDB & ODBC?


Solution:
ADO : ActiveX Data Objects is universal data access framework that encompasses the functionality
of DAO.
ODBC : Open Database Connectivity(ODBC) is a windows technology that lets a database client
application connect to a external database.
OLEDB : Low level programming interface designed to access a wide variety of data access Object
Linking and Embedding (OLE).

Ques 24. How to set the custom paper size in Excel Object through VB?
Solution: Activesheet.PageSetup.PaperSize = xlPaperLetter (Similarly xlPaperA4 or xlPaperLegal
etc.)
Ques 25. What is the method for returning more than one values from a function in VB?
Solution: Any of the three methods can be used:
i) Create a class with the properties you require to return and then return the object of the class
from the function.
ii) Using ByRef for the values.
iii) Return an array of the values.

Ques 26. Does VBA supports OOP principles?


Solution: Yes because VBA is VB6.0 based which is an Object Based Programming Language and is
also known as 'Event Driven Programming' and it supports Polymorphism, Encapsulation and
partially Inheritance.

Ques 27. To set the command button for ESC, Which property needs to be changed?
Solution: Set Cancel property of Button to True on the Form.

Ques 30. What is a Variant, what the pros and cons of its use?
Solution: Variant data type is able to hold any other data type, including numbers, strings, dates,
and object references. A Variant's descriptor is only 16 bytes long (4 short words for the type, and
2 long words for the data, or data pointer).
Pros: You cannot use Null with any variable type other than Variant.
You don't need to worry about what you have declared a variable as.
When a Variant has been declared but not assigned a value, it contains the special value Empty.
Cons: A developer may not remember and misuse a variable assigning any value to it which will be
type-casted without errors.

Ques 31. Give technical reasons which made Microsoft withdraw its support for VBA in Mac?
Solution: The reasons which made Microsoft drop its support to VBA are as follows, Microsoft
visual basic relies heavily on machine code which was written for Power PC architecture. Also it
would take another two years for developing VBA support for its architecture. It also states that
Microsoft will incorporate VBA in the next script of office release for Mac.

Ques 33. Give some examples of Volatile function.


Solution:
Some of Excel’s functions are obviously volatile: RAND(), NOW(), TODAY()
Others are less obviously volatile: OFFSET(), CELL(), INDIRECT(), INFO()
Some are volatile in some versions of Excel but not in others: INDEX()became non-volatile in Excel
97.
A number of functions that are documented by Microsoft as volatile do not actually seem to be
volatile when tested:
INDEX(), ROWS(), COLUMNS(), AREAS()
and CELL("Filename") IS volatile although a MSKBN article says its not.
One particular syntax of SUMIF is volatile in Excel 2002 and subsequent versions:
=SUMIF(A1:A4,">0",B1) is volatile whereas =SUMIF(A1:A4,">0",B1:B4) is not volatile.

Ques 35. Is it possible to apply 'Application.Volatile(False)' to a volatile public function like


INDEX and make it not volatile?
Solution: Actually INDEX is not a volatile function, even though some MicroSoft documentation
says it is. Anyway no its not possible to apply Application.Volatile(False) to a built-in Excel
function except by duplicating what the built-in function does inside a UDF.

Ques 36. What is Excel dependency tree?


Solution: Dependency trees are excel way of minimizing the calculation by tracking what has
changed since last calculation. It allows Excel to recalculate only:
        * Formulae/Names that have changed.
        * Formulae containing Volatile Functions
        * Formulae dependent on changed or volatile formulae or cells or names.

Excel determines dependencies by looking at the cells referred to by each formula and by the
argument list of each function.
Dependency trees are immediately updated whenever a formula is entered or changed.
To force the dependency trees to be rebuilt and all formulae calculation use CTRL+ALT+SHIFT+F9.

Ques 37. What are keyboard shortcuts and their equivalent VBA methods for Formulae
calculation and building Excel dependency trees?
Solution:

Shortcut Combination VBA Equivalent Meaning


F9 Application.Calculate Recalculate
Ctrl+Alt+F9 Application.CalculateFull Full Calculation
Rebuild Excel Dependency Tree 
Ctrl+Alt+Shift+F9 Application.CalculateFullRebuild
and Full Calculation
Shift+F9 Sheets(1).Calculate Calculate Worksheet

Ques 44. What do you know about multi threaded calculation?


Solution: Excel 2007 can split calculation across multiple processors or cores. When Excel 2007
loads a workbook, it determines from the operating system how many processors are available and
then creates a separate calculation thread for each processor. These threads can then run in
parallel. The beauty of this system is that it scales extremely well with the number of processors.

Most workbooks show a significant improvement in calculation speed on a system with multiple
cores. The degree of improvement depends on how many independent calculation trees the
workbook contains. If you make a workbook that contains one continuous chain of formulas, it will
not show any multithreaded calculation (MTC) performance gain, whereas a workbook that
contains several independent chains of formulas will show gains close to the number of processors
available.

Ques 45. How can we dial a phone number?


Solution: Shell command present in VBA can be used to start the dialer present in windows
operating system. Phone number can be used to connect to your modem. With the use of shell and
sendkeys you can dial to your user. Shell starts windows application and sendkeys inform the
window to dial according to the keystrokes of the application. A macro can be used to start the
cardfile program which activates the auto dialer feature.

Ques 46. What do you know about the interpretation features of VBA?
Solution: VBA is licensed to Microsoft and this compatible with and only Microsoft products. Code
written is compiled by an intermediate language called P-code and this is stored in hosting
applications such as Excel, Word and Access. The intermediate code is interpreted by a virtual
machine. This code and intermediate language is the exclusive right of Microsoft.

Ques 47. Explain about insert module and Goal Seek functions present in VBA?
Solution: The chief use of VBA is to make use of its special function which helps in repeated
actions. Goal seek function helps to reduce manual entry of the code each and every time. This
solves the problem of repeated function entry by automating functions and actions. Sub routines
are inserted into the using the VBA editor and command insert module.

Ques 48. State the difference between Visual Basic, VB Script and Visual Basic for
Applications?
Solution: Visual basic is useful if you are planning to develop your programs from scratch.This
language helps you in developing Active x controls, exe files, etc.
VB script is a powerful tool, through which you can create small scale applications on web pages,
automation applications, etc. Integrated development environment is not present for VB script.
Visual Basic for Applications are very useful in automating your existing application. VB
application is useful for developing already existing applications.

Ques 49. Write a macro to select all the non-blank cells of Activesheet ?

Solution:
Sub NonBlankCells()
    On Error Resume Next
    Union(Cells.SpecialCells(xlCellTypeFormulas, 23), Cells.SpecialCells(xlCellTypeConstants,
23)).Select
    If Err.Number <> 0 Then
        Cells.SpecialCells(xlCellTypeFormulas, 23).Select
    Else
        Exit Sub
    End If
    If Err.Number <> 0 Then
        Cells.SpecialCells(xlCellTypeConstants, 23).Select
    Else
        Exit Sub
    End If
    On Error GoTo 0
End Sub

Ques 50. What is the difference between UsedRange and CurrentRegion properties ?
Solution:
i) The current region is a range bounded by any combination of blank rows and blank columns.
This property is useful for many operations that automatically expand the selection to include the
entire current region, such as the AutoFormat method. This property cannot be used on a
protected worksheet.
The UsedRange property is used to select the range of used cells on a worksheet. It returns a
Range object that represents the used range on the specified worksheet.
ii) Every non-blank cell got its CurrentRegion and its keyboard shortcut is Ctrl+Shift+Spacebar.
iii) There can be many current regions but there is only one used range in a worksheet

http://www.excelfunctions.net/ExcelFunction
s.html
Excel Text Functions
Functions to Remove Extra Characters Replacing / Substituting Parts of a Text String

CLEAN Removes all non-printable characters from a


REPLACE Replaces all or part of a text string with
supplied text string
another string (from a user supplied
position)
TRIM Removes duplicate spaces, and spaces at
the start and end of a text string
SUBSTITUTE Substitutes all occurrences of a search text
string, within an original text string, with the
Functions to Convert Excel Data Types supplied replacement text

BAHTTEXT Converts a number, plus the suffix "Baht" into


Cutting Up & Piecing Together Text Strings
Thai text

DOLLAR Converts a supplied number into text, using CONCATENAT


a Joins together two or more text strings
currency format E

FIXED Rounds a supplied number to a specified LEFT Returns a specified number of


number of decimal places, and then converts characters from the start of a supplied
this into text text string

TEXT Converts a supplied value into text, using MID


a Returns a specified number of
user-specified format characters from the middle of a supplied
text string
VALUE Converts a text string into a numeric value
RIGHT Returns a specified number of
Functions to Convert Between Upper & Lower Case characters from the end of a supplied
text string
LOWER Converts all characters in a supplied text
string to lower case REPT Returns a string consisting of a supplied
text string, repeated a specified number
PROPER Converts all characters in a supplied text of times
string to proper case (ie. the first character in
each word is upper case and all other
Information Functions
characters are lower case)

LEN Returns the length of a supplied text string


UPPER Converts all characters in a supplied text
string to upper case
FIND Returns the position of a supplied character
or text string from within a supplied text
Converting Between Characters & Numeric Codes
string (case-sensitive)

CHAR Returns the character that corresponds to a


SEARCH Returns the position of a supplied character
supplied numeric value or text string from within a supplied text
string (non-case-sensitive)
CODE Returns the numeric code for the first
character of a supplied string EXACT Tests if two supplied text strings are exactly
the same and if so, returns TRUE;
Otherwise, returns FALSE. (case-sensitive)

T Tests whether a supplied value is text and


if so, returns the supplied text; If not,
returns an empty text string.

Excel Logical Functions

Boolean Operator Functions Conditional Functions

IF Tests a user-defined condition and returns one


AND Tests a number of user-defined conditions and
result if the condition is TRUE, and another
returns TRUE if ALL of the conditions evaluate
result if the condition is FALSE
to TRUE, or FALSE otherwise

IFERRO Tests if an initial supplied value (or expression)


OR Tests a number of user-defined conditions andR returns an error, and if so the function returns
returns TRUE if ANY of the conditions evaluate a supplied value; Otherwise the function
to TRUE, or FALSE otherwise returns the initial value. (New in Excel 2007)

NOT Returns a logical value that is the opposite of Functions


a Returning Constant Values
user supplied logical value or expression
(ie. returns FALSE is the supplied argument is TRUE Simply returns the logical value TRUE
TRUE and returns TRUE if the supplied
argument is FALSE) FALSE Simply returns the logical value FALSE

Excel Information Functions


Error Information Functions Other Data Type Functions

ISERROR Tests if an initial supplied value (or


ISBLANK Tests if a supplied cell is blank (empty), and
expression) returns an error and if so,
if so, returns TRUE; Otherwise, returns
returns TRUE; Otherwise returns FALSE
FALSE

ISERR Tests if an initial supplied value (or


ISLOGICAL
expression) returns an error (EXCEPT for Tests if a supplied value is a logical value,
the #N/A error) and if so, returns TRUE and if so, returns TRUE; Otherwise, returns
Otherwise returns FALSE FALSE

ISNA Tests if an initial supplied value (or


ISTEXT Tests if a supplied value is text, and if so,
expression) returns the Excel #N/A error
returns TRUE; Otherwise, returns FALSE
and if so, returns TRUE; Otherwise returns
FALSE
ISNONTEX Tests if a supplied value is text, and if it is
ERROR.TYP Tests a supplied value and returns an T NOT, returns TRUE; Otherwise, returns
E integer relating to the supplied value's error FALSE
type
ISREF Tests if a supplied value is a reference, and
Numerical Information Functions
if so, returns TRUE; Otherwise, returns
FALSE
ISNUMBE Tests if a supplied value is a number, and if
R so, returns TRUE; Otherwise, returns
FALSE. TYPE Returns information about the data type of a
supplied value
ISEVEN Tests if a supplied number (or expression) is
an even number, and if so, returns TRUE; General Information Functions
Otherwise, returns FALSE.
CELL Returns information about the contents,
ISODD Tests if a supplied number (or expression) is formatting or location of a given cell
an odd number, and if so, returns TRUE;
Otherwise, returns FALSE.
INFO Returns information about the the current
Converts a non-number value to a number, a operating environment
N
date to a serial number, the logical value
TRUE to 1 and all other values to 0 Function Returning a Constant Value

NA Returns the Excel #N/A error

Excel Date and Time Functions


Before using the Date and Time Excel Functions, it is advised that you ensure you have a clear understanding
of the way Excel stores Dates and Times - For details, see the Excel Dates and Times pages.

Creating Dates & Times Performing Calculations with Dates

DATE Returns a date, from a user-supplied year,


EDATE Returns a date that is the specified
month and day
number of months before or after
an initial supplied start date
TIME Returns a time, from a user-supplied hour,
minute and second
EOMONTH Returns a date that is the last day
DATEVALU Converts a text string showing a date, to an of the month which is a specified
E integer that represents the date in Excel's number of months before or after
date-time code an initial supplied start date

TIMEVALUE Converts a text string showing a time, to a


WORKDAY Returns a date that is a supplied
decimal that represents the time in Excel
number of working days (excluding
weekends & holidays) ahead of a
Current Date & Time given start date

NOW Returns the current date & time


WORKDAY.INTL Returns a date that is a supplied
number of working days (excluding
TODAY Returns today's date
weekends & holidays) ahead of a
given start date, using supplied
Extracting The Components of a Time parameters to specify weekend
days (New in Excel 2010)
HOUR Returns the hour part of a user-supplied time

DAYS360 Calculates the number of days


MINUTE Returns the minute part of a user-supplied
between 2 dates, based on a 360-
time
day year (12 x 30 months)

SECOND Returns the seconds part of a user-supplied


time NETWORKDAYS Returns the number of whole
networkdays (excluding weekends
& holidays), between two supplied
Extracting The Components of a Date
dates

DAY Returns the day (of the month) from a user-


supplied date NETWORKDAYS.INT Returns the number of whole
L networkdays (excluding weekends
MONTH Returns the month from a user-supplied date & holidays), between two supplied
dates, using parameters to specify
weekend days (New in Excel 2010)
YEAR Returns the year from a user-supplied date

WEEKNU YEARFRAC
Returns an integer representing the week Calculates the fraction of the year
M number (from 1 to 53) of the year from a represented by the number of
user-supplied date whole days between two dates

WEEKDAY Returns an integer representing the day of


the week for a supplied date

Excel Lookup and Reference Functions

Functions To Return References to Cell Ranges Data Lookup Functions

HLOOKUP Looks up a supplied value in the first


ADDRESS Returns a reference, in text format, for a
row of a table, and returns the
corresponding value from another row
supplied row and column number

VLOOKUP Looks up a supplied value in the first


INDEX Returns a reference to a cell (or range of column of a table, and returns the
cells) for requested rows and columns within corresponding value from another
a supplied range column

LOOKUP Searches for a specific value in one


INDIRECT Returns a cell or range reference that is
data vector, and returns a value from
represented by a supplied text string
the corresponding position of a second
data vector
OFFSET Returns a reference to a range of cells that is
a specified number of rows and columns GETPIVOTDAT Extracts data stored in a Pivot Table
from an initial supplied range A

CHOOSE Returns one of a list of values,


Row / Column / Area Information
depending on the value of a supplied
index number
ROW Returns the current row number of the
spreadsheet MATCH Finds the relative position of a value in a
supplied array
COLUMN Returns the current column number of the
spreadsheet Other

HYPERLINK Creates a hyperlink to a document in a


ROWS Returns the number of rows in a supplied
supplied location.
range

TRANSPOSE Performs a transpose transformation on a


COLUMNS Returns the number of columns in a supplied range of cells (ie. transforms a horizontal
range range of cells into a vertical range and
vice versa)
AREAS Returns the number of areas in a supplied
range RTD Retrieves real-time data from a program
that supports COM automation

Excel Math and Trig Functions


Basic Numeric Information Conditional Sums

SUMIF Adds the cells in a supplied range, that


ABS Returns the absolute value (ie. the modulus)
satisfy a given criteria
of a supplied number

SUMIFS Adds the cells in a supplied range, that


SIGN Returns the sign (+1, -1 or 0) of a supplied satisfy multiple criteria (New in Excel
number 2007)

GCD Returns the Greatest Common Divisor of two Advanced Mathematical Operations
or more supplied numbers
SUMPRODUC Returns the sum of the products of
T corresponding values in two or more
LCM Returns the Least Common Multiple of two or
supplied arrays
more supplied numbers

SUMSQ Returns the sum of the squares of a


Basic Mathematical Operations supplied list of numbers

SUM Returns the sum of a supplied list of SUMX2MY2 Returns the sum of the difference of
numbers squares of corresponding values in two
supplied arrays

PRODUCT Returns the product of a supplied list of


SUMX2PY2 Returns the sum of the sum of squares of
numbers
corresponding values in two supplied
arrays
POWER Returns the result of a given number raised
to a supplied power SUMXMY2 Returns the sum of squares of
differences of corresponding values in
SQRT Returns the positive square root of a given two supplied arrays
number
SERIESSUM Returns the sum of a power series
QUOTIENT Returns the integer portion of a division
between two supplied numbers Trigonometry Functions

PI Returns the constant value of pi


MOD Returns the remainder from a division
between two supplied numbers
SQRTPI Returns the square root of a supplied
number multiplied by pi
AGGREGAT Performs a specified calculation (eg. the
E sum, product, average, etc.) for a list or
DEGREES Converts Radians to Degrees
database, with the option to ignore hidden
rows and error values (New in Excel 2010)
RADIANS Converts Degrees to Radians

SUBTOTAL Performs a specified calculation (eg. the


COS Returns the Cosine of a given angle
sum, product, average, etc.) for a supplied
set of values
ACOS Returns the Arccosine of a number

Rounding Functions Returns the hyperbolic cosine of a number


COSH

CEILING Rounds a number away from zero (ie. Factorials


rounds a positive number up and a
negative number down), to a multiple of FACT Returns the Factorial of a given number
significance
CEILING.PRECISE Rounds a number up, regardless of the FACTDOUBLE Returns the Double Factorial of a given
sign of the number, to a multiple of number
significance (New in Excel 2010)
MULTINOMIAL Returns the Multinomial of a given set of
ISO.CEILING Rounds a number up, regardless of the numbers
sign of the number, to a multiple of
significance. (New in Excel 2010)
Random Numbers

EVEN Rounds a number away from zero (ie. RAND Returns a random number between 0
rounds a positive number up and a and 1
negative number down), to the next
even number
RANDBETWEE Returns a random number between two
N given integers
FLOOR Rounds a number towards zero, (ie.
rounds a positive number down and a Miscellaneous
negative number up), to a multiple of
significance
COMBIN Returns the number of combinations for a
given number of objects
FLOOR.PRECISE Rounds a number down, regardless of
the sign of the number, to a multiple of Returns a text string depicting the roman
ROMAN
significance (New in Excel 2010) numeral for a given number

INT Rounds a number down to the next ROUNDDOWN Rounds a number towards zero, (ie.
integer rounds a positive number down and a
negative number up), to a given number
MROUND Rounds a number up or down, to the of digits
nearest multiple of significance
ROUNDUP Rounds a number away from zero (ie.
ODD Rounds a number away from zero (ie. rounds a positive number up and a
rounds a positive number up and a negative number down), to a given
negative number down), to the next number of digits
odd number
TRUNC Truncates a number towards zero (ie.
ROUND Rounds a number up or down, to a rounds a positive number down and a
given number of digits negative number up), to the next integer.

Excel Database Functions


Database Functions Database Functions

DAVERAG Calculates the average of values in a field of


DPRODUC Calculates the product of values in a field of
E a list or database, that satisfy specified T a list or database, that satisfy specified
conditions conditions
DCOUNT Returns the number of cells containing DSTDEV Calculates the standard deviation (based on
numbers in a field of a list or database that a sample of a population), of values in a
satisfy specified conditions field of a list or database, that satisfy
specified conditions
DCOUNTA Returns the number of non-blank cells in a
field of a list or database, that satisfyDSTDEVP Calculates the standard deviation (based on
specified conditions an entire population), of values in a field of a
list or database, that satisfy specified
conditions
DGET Returns a single value from a field of a list or
database, that satisfy specified conditions
DSUM Calculates the sum of values in a field of a
list or database, that satisfy specified
DMAX Returns the maximum value from a field of a
conditions
list or database, that satisfy specified
conditions
DVAR Calculates the variance (based on a sample
of a population), of values in a field of a list
DMIN Returns the minimum value from a field of a
or database, that satisfy specified conditions
list or database, that satisfy specified
conditions
DVARP Calculates the variance (based on an entire
population), of values in a field of a list or
database, that satisfy specified conditions

Excel Financial Functions


Investment Value Functions Internal Rate of Return Functions

FV Calculates the future value of an


IRR Calculates the internal rate of return for a
investment with periodic constant
series of cash flows
payments and a constant interest rate

FVSCHEDUL MIRR
Calculates the future value of an initial Calculates the internal rate of return for a
E principal, after applying a series of series of periodic cash flows, considering the
compound interest rates cost of the investment and the interest on the
reinvestment of cash
NPV Calculates the net present value of an
investment, based on a supplied discountXIRR Calculates the internal rate of return for a
rate, and a series of future payments and schedule of cash flows
income

PV Calculates the present value of an Asset Depreciation Functions


investment (ie. the total amount that a
series of future payments is worth now)
AMORDEGR Calculates the prorated linear depreciation
C of an asset for each accounting period
RECEIVED Calculates the amount received at maturity
(with depreciation coefficient applied,
for a fully invested Security
depending on the life of the asset)

XNPV Calculates the net present value for a


schedule of cash flows AMORLINC Calculates the prorated linear depreciation
of an asset for each accounting period

Payment Functions
DB Calculates the depreciation of an asset for
a specified period, using the fixed-
CUMIPMT Calculates the cumulative interest paid
declining balance method
between two specified periods

CUMPRINC DDB
Calculates the cumulative principal paid on Calculates the depreciation of an asset for
a loan, between two specified periods a specified period, using the double-
declining balance method, or some other
user-specified method
IPMT Calculates the interest payment for a given
period of an investment, with periodic
constant payments and a constant interest SLN Returns the straight-line depreciation of an
rate asset for one period

ISPMT Returns the interest paid during a specified Returns the sum-of-years' digits
SYD
period of an investment depreciation of an asset for a specified
period
PMT Calculates the payments required to reduce
a loan, from a supplied present value to a
specified future value VDB Returns the depreciation of an asset for a
specified period, (including partial
periods), using the double-declining
PPMT Calculates the payment on the principal for balance method or another user-specified
a given investment, with periodic constant method
payments and a constant interest rate

Duration Functions Interest Rate Functions

COUPDAYBS Calculates the number of days from the


ACCRINT Calculates the accrued interest for a security
beginning of the coupon period to the that pays periodic interest
settlement date

ACCRINTM Calculates the accrued interest for a security


COUPDAYS Calculates the number of days in the
that pays interest at maturity
coupon period that contains the
settlement date
DISC Calculates the discount rate for a security
COUPDAYSN Calculates the number of days from the
C settlement date to the next coupon date
EFFECT Calculates the effective annual interest rate

COUPNCD Returns the next coupon date after the


settlement date INTRATE Calculates the interest rate for a fully
COUPNUM Returns the number of coupons payable invested security
between the settlement date and maturity
date
NOMINAL Calculates the annual nominal interest rate

COUPPCD Returns the previous coupon date, before


the settlement date RATE Calculates the interest rate required to pay
off a specified amount of a loan, or reach a
DURATION Calculates the annual duration of a target amount on an investment over a given
security with periodic interest payments period

MDURATION Calculates the Macauley modified


Dollar Conversion
duration for a security with an assumed
par value of $100
DOLLARD Converts a dollar price expressed as a
NPER Returns the number of periods for an E fraction, into a dollar price expressed as a
investment with periodic constant decimal
payments and a constant interest rate

DOLLARFR Converts a dollar price expressed as a


Yield Functions decimal, into a dollar price expressed as a
fraction
YIELD Calculates the yield of a security that pays
periodic interest
Price Functions

YIELDDISC Calculates the annual yield of a discounted


security PRICE Calculates the price per $100 face value of
a security that pays periodic interest
YIELDMAT Calculates the annual yield of a security that
pays interest at maturity PRICEDISC Calculates the price per $100 face value of
a discounted security
ODDFYIELD Calculates the yield of a security with an
odd first period PRICEMAT Calculates the price per $100 face value of
a security that pays interest at maturity
ODDLYIELD Calculates the yield of a security with an
odd last period ODDFPRICE Calculates the price per $100 face value of
a security with an odd first period
TBILLEQ Calculates the bond-equivalent yield for a
treasury bill
ODDLPRICE Calculates the price per $100 face value of
a security with an odd last period
TBILLYIELD Calculates the yield for a treasury bill

TBILLPRICE Calculates the price per $100 face value for


a treasury bill
Excel Operators
Although the Excel Operators are not, strictly speaking, Excel Functions, a brief explanation of them is included
in the following page:

Excel Mathematical Operators - used to perform basic Mathematical operations,


such as addition, subtraction, multiplication, division and raising to a power,
Excel Operators
OR

the & Excel Operator is used to concatenate text strings

Related Functions :
Basic Description
LOOKUP Function

VLOOKUP Function

The Excel HLOOKUP function 'looks up' a given value in the top row of a data array (or table), and returns the
corresponding value from another row of the array.

The format of the function is:

HLOOKUP( lookup_value, table_array, row_index_num, [range_lookup] )

where the arguments are as follows:

lookup_value - The value that you want to look for, in the first row of the supplied data
array

table_array - The data array or table, that you want to search the first row of, for the
supplied lookup_value

row_index_nu - The row number, within the supplied array, that you want the
m corresponding value to be returned from

[range_lookup] - An optional logical argument, which can be set to TRUE or FALSE,


meaning :
TRUE - if the function cannot find an exact match to the supplied
lookup_value, it should use the closest match below the
supplied value
(Note: If range_lookup is set to TRUE, the top row of the
table_array must be in ascending order)

FALS - if the function cannot find an exact match to the supplied


E lookup_value, it should return an error

Examples
Hlookup Example 1
Cells A2-F6 of the spreadsheet below, show the exam scores for 5 students in 4 different subjects. If you want
to look up a specific score (eg. Biology) for one of the students (eg. Ed), this can be done using the Hlookup
function, as shown in cell B10 of the spreadsheet.

In the example below, the formula is shown in cell B10 of the spreadsheet on the left, and the result is shown in
the spreadsheet on the right.

 Formulas:  Results:

In the above example, the Hlookup function searches through the top row of the table_array (the range A2-A6),
to find a match for the lookup_value (the name "Ed", in cell A10). When the the name 'Ed' is found, the function
returns the corresponding value from the 5th row of the lookup_table.

This is illustrated on the right. The function finds the name 'Ed' in the top row of the table_array and then
returns the value from the 5th row of the table_array.

If we change the name in the individual spreadsheet from 'Ed' to 'Cara', the Hlookup functions would
automatically recalculate the functions to display the exam results for Cara.
Hlookup Example 2
Cells A1-F3 of the spreadsheet below, show body types relating to body mass index (BMI), for the ranges
0 - 18.4, 18.5 - 24.9, 25.0 - 29.9 and over 30.

Cell C6 shows the user's current BMI, which is 23.5, and cell C7 shows the Hlookup function that is used to
look up the body type that relates to this BMI.

The Hlookup function in the above spreadsheet returns the result "Normal Weight", which is the correct body
type for a BMI of 23.5.

Note that, in this example, the range_lookup argument is set to TRUE, to tell that function that, if it cannot find
an exact match to the supplied lookup_value, it should use the closest match below this value. Therefore, for all
BMIs up to and including 18.4 the function would return "Underweight", for all BMIs between 18.5 and 24.9, the
function would return "Normal Weight", etc.

Further Hlookup Examples


For a practical example of the HLOOKUP function being used to create a variable drop-down list, see the
Variable Drop-Down List page.

Also, there are further examples on the Microsoft Office website.

Trouble Shooting
If you get an error from the Excel Hlookup function this is likely to be one of the following :

Common Errors

#N/A - Occurs if the Hlookup function fails to find a match to the supplied lookup_value

The cause of this will generally depend on the supplied range_lookup:

if range_lookup = TRUE - the #N/A error is likely to be because the smallest value in the
(or is omitted) lookup row is greater than the supplied lookup_value

the #N/A error is likely to be because an exact match to the


if range_lookup = -
lookup_value is not found in the lookup row
FALSE
if you can't understand why this is, check out Common Problem
No. 1 (below).

#VALU - Occurs if either:


E!
The supplied row_index_num argument is < 1 or is not recognised as a numeric
-
value

or

- The supplied range_lookup argument is not recognised as TRUE or FALSE

#REF! - Occurs if the supplied row_index_num argument is greater than the number of rows in the
supplied table_array

Also, the following problem is encountered by some users:

Common Hlookup Problem

You can see the value that you want to look up in your table_array, but your Excel HLOOKUP is returning the #N/A error.
Why can't it 'see' the lookup_value in the table_array?

Possible Reason No. 1

You may have unseen spaces at the start or end of either the value you are looking up, or in the cells of your table_array.
These spaces cause your lookup_value cell and the 'matching' cell in your table_array to have slightly different content.

Solution No. 1

Check the contents of the cells that you believe should match. If there are unseen additional spaces in one or both of the
lists, remove these using the TRIM function:

1. Create a new row or column next to the one with the additional spaces in it
2. Use the TRIM function in your new row or column, to get rid of extra spaces
3. Copy the contents of the new row or column and paste these over the top of the original row or column, using
paste->special->values
4. Delete the row or column containing the TRIM function

Possible Reason No. 2


The contents of the cells that are being compared may have different data types. For example, the cell containing your
lookup_value may be stored as a number by Excel, whereas the values in your table_array may be stored as text even
though they look like numbers.

Solution No. 2
Force both sets of data to have the same type. For example, if you want both sets of values to be stored as text, convert
both sets of data to text, using Excel's Text To Columns tool:
1. Use the mouse to select the cells you want to convert to text (this must be done one column at a time)
2. From the Data tab at the top of your Excel workbook, select the Text to Columns ... option
3. Make sure the Delimited option is selected and click next
4. Make sure all the delimiter options are unselected and then click next again
5. You should now be offered a selection of Column Data Formats. Select Text and click the Finish button

The data in your selected cells should now be stored as text within Excel and so the Excel Hlookup function should be able
to 'look up' the matching value.

Note that you could have chosen to convert the contents of your cells to Excel's 'general' type, by simply selecting the
column data format General in the Text To Columns tool.

Basic Description
The Excel VLOOKUP function 'looks up' a given value in the left-hand column of a data array (or table), and
returns the corresponding value from another column of the array.

The format of the function is:

VLOOKUP( lookup_value, table_array, col_index_num, [range_lookup] )

where the arguments are as follows:

lookup_value - The value that you want to look for, in the left-hand column of the supplied
data array

table_array - The data array or table, that you want to search the left hand column of,
for the supplied lookup_value

col_index_nu - The column number, within the supplied array, that you want the
m corresponding value to be returned from

[range_lookup - An optional logical argument, which can be set to TRUE or FALSE,


] meaning :
TRUE - if the function cannot find an exact match to the supplied
lookup_value, it should use the closest match below the
supplied value

(Note: If range_lookup is set to TRUE, the left-hand column of


the table_array must be in ascending order)

FALS - if the function cannot find an exact match to the supplied


E lookup_value, it should return an error

Vlookup Examples
Vlookup Example 1
In the spreadsheet below, columns A and B list an inventory of grocery items, and their prices, and cell E2 of
the spreadsheet shows a simple example of the Vlookup function being used to look up the price of an item
from the inventory.

The above Vlookup function returns the price for "Cornflakes", which is $3.50.

In this example:
- the lookup_value is the text string "Cornflakes", which is located in cell D2

- the table_array is columns A-B of the spreadsheet

- the col_index_num is set to 2, to denote that the value returned should be taken from column 2 of the
table_array

- the range_lookup argument is set to FALSE, to indicate that we only want a result to be returned if an
exact match to the lookup_value is found

Vlookup Example 2
In the spreadsheet below, columns A-C list the grades that are assigned to examination marks lying within the
ranges 0-44%, 45%-54%, etc.

Cell F2 shows the score of 52% that was achieved by the student "Anne" in an examination. The Vlookup
function in cell G2 looks up this score in column A of the spreadsheet and returns the associated grade from
column C. Note that, in this example, if the exact score of 52% is not found in column A, we want, instead, to
use the nearest value below this score.

The above Vlookup function returns the grade for the score 52%, which is E.

In this example:
- the lookup_value is the value 52%, which is located in cell F2

- the table_array is the range A2-C7 of the spreadsheet

- the col_index_num is set to 3, to denote that the value returned should be taken from column 3 of the
table_array

- the range_lookup argument is set to TRUE, to indicate that, if an exact match to the lookup_value is not
found, we want to use the closest value below the lookup_value

Further Vlookup Examples


For a practical example of the Vlookup function being used to create a variable chart, see the Excel Variable
Chart page.

Also, there are several further Vlookup examples on the Microsoft Office website.

Using Vlookup in VBA


Although there is no VBA Vlookup function, you can call the Excel Worksheet Vlookup Function from VBA. See
the VBA Vlookup page for more details.

Trouble Shooting
If you get a Vlookup error this is likely to be one of the following :

Common Vlookup Errors

#N/A - Occurs if the Vlookup function fails to find a match to the supplied lookup_value

The cause of this will generally depend on the supplied [range_lookup] argument:
if [range_lookup] = TRUE - the #N/A error is likely to be because the smallest value in the
(or is omitted) left-hand column of the table_array is greater than the supplied
lookup_value

if [range_lookup] = FALSE - the #N/A error is likely to be because an exact match to the
lookup_value is not found in the left-hand column of the
table_array

If you still can't understand why you are getting this Vlookup error, check out the Vlookup
#N/A Error page

#VALU - Occurs if either:


E!
The supplied col_index_num argument is < 1 or is not recognised as a numeric
-
value

or

- The supplied range_lookup argument is not recognised as TRUE or FALSE

#REF! - Occurs if either:

- the supplied col_index_num argument is greater than the number of columns in the
supplied table_array

or

- the formula has attempted to reference cells that do not exist.


This can be caused by relative referencing errors when the Vlookup is copied to
other cells

If you need further help with this Vlookup error, check out the Vlookup #REF! Error page
The Excel GETPIVOTDATA function extracts data from an Excel Pivot Table

The format of the function is :

GETPIVOTDATA( Data_field, Pivot_table, [Field1], [Item1], [Field2], [Item2], ...)

where the arguments are as follows:

Data_field - The pivot table data field (ie. the value(s) in the center
of the table) that you want to retrieve

Pivot_table - A reference to a range of cells within a Pivot Table


(used to specify the pivot table to be searched)

[Field1], - Up to 126 optional pairs of fields and item names, (ie.


[Item1], The rows and columns headers and individual
[Field2], categories) for which you want the returned value.
[Item2], Note: The item values should be entered as follows:
etc
-    Numbers can be entered directly
-    Dates should be entered as date serial numbers or
by using the date function
-    Times should be entered as decimals or by using
the time function
-    Text values should be entered in quotations

Note that, if the requested fields are not visible in the specified Pivot Table, the
Getpivotdata function returns the #REF! error.

The easiest way to input the Getpivotdata function is simply to type "=" into a cell and then
click on the Pivot Table value that you want to return. Excel automatically inserts the
Getpivotdata function into the active cell.

Examples
The examples below all refer to the following Pivot Table, which is located in columns A -
G of the current Excel Worksheet.

  A B C D E F G  

1                

2 Sum of Invoice Amount Item Type    


Total

3 Date Salesperson Digital TV DVD IPod Computer Grand  


Player Total

4 Jan John $68,600 $13,800 $6,840 $69,600 $158,840  

5 Kevin $64,400 $7,800 $12,780 $36,800 $121,780  

6 Pete $46,200 $2,400 $2,700 $25,600 $76,900  

7 Jan Total $179,200 $24,000 $22,320 $132,000 $357,520  

8 Feb John $68,600 $8,400 $9,720 $52,800 $139,520  

9 Kevin $61,600 $4,500 $7,920 $43,200 $117,220  

10 Pete $29,400 $3,900 $6,300 $33,600 $73,200  

11 Feb Total $159,600 $16,800 $23,940 $129,600 $329,940  

12 Mar John $71,400 $9,300 $7,560 $80,000 $168,260  

13 Kevin $70,000 $10,200 $13,680 $58,400 $152,280  

14 Pete $43,400 $5,400 $3,240 $40,800 $92,840  

15 Mar Total $184,800 $24,900 $24,480 $179,200 $413,380  

16 Grand Total $523,600 $65,700 $70,740 $440,800 $1,100,840  

17                

=GETPIVOTDATA( "Invoice Amount", $A$2, "Date", "Jan" )

- Returns the value $357,520, which is the value of the Invoice Amount Total for all of the
Date field, "Jan".

=GETPIVOTDATA( "Invoice Amount", $A$2, "Date", "Feb", "Item Details", "IPod" )

- Returns the value $23,940, which is the value of the Invoice Amount Total for the Date
field, "Feb" and the Item Details field, "IPod".

=GETPIVOTDATA( "Invoice Amount", $A$2, "Date", "Feb", "Item Details", "IPod",


"Salesperson", "Kevin" )

- Returns the value $7,920, which is the value of the Invoice Amount Total for the Date
field, "Feb", the Item Details field, "IPod", and the Salesperson field "Kevin".

=GETPIVOTDATA( "Invoice Amount", $A$2, "Item Details", "IPod", "Salesperson",


"Kevin" )

- Returns the Excel #REF! error as the Pivot Table doesn't show the totals for the
Salesperson "Kevin".

Das könnte Ihnen auch gefallen