excel questions
TRANSCRIPT
![Page 1: Excel Questions](https://reader035.vdocument.in/reader035/viewer/2022081505/551555fb4a7959af658b466d/html5/thumbnails/1.jpg)
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
![Page 2: Excel Questions](https://reader035.vdocument.in/reader035/viewer/2022081505/551555fb4a7959af658b466d/html5/thumbnails/2.jpg)
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)
![Page 3: Excel Questions](https://reader035.vdocument.in/reader035/viewer/2022081505/551555fb4a7959af658b466d/html5/thumbnails/3.jpg)
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.
![Page 4: Excel Questions](https://reader035.vdocument.in/reader035/viewer/2022081505/551555fb4a7959af658b466d/html5/thumbnails/4.jpg)
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.
![Page 5: Excel Questions](https://reader035.vdocument.in/reader035/viewer/2022081505/551555fb4a7959af658b466d/html5/thumbnails/5.jpg)
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
Ctrl+Alt+Shift+F9Application.CalculateFullRebuild
Rebuild Excel Dependency Tree 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?
![Page 6: Excel Questions](https://reader035.vdocument.in/reader035/viewer/2022081505/551555fb4a7959af658b466d/html5/thumbnails/6.jpg)
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
![Page 7: Excel Questions](https://reader035.vdocument.in/reader035/viewer/2022081505/551555fb4a7959af658b466d/html5/thumbnails/7.jpg)
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/ExcelFunctions.html
Excel Text Functions
Functions to Remove Extra Characters
CLEAN Removes all non-printable characters from a supplied text string
TRIM Removes duplicate spaces, and spaces at the start and end of a text string
Functions to Convert Excel Data Types
BAHTTEXT Converts a number, plus the suffix "Baht" into Thai text
DOLLAR Converts a supplied number into text, using a currency format
FIXED Rounds a supplied number to a specified number of decimal places, and then converts
Replacing / Substituting Parts of a Text String
REPLACE Replaces all or part of a text string with another string (from a user supplied position)
SUBSTITUTE Substitutes all occurrences of a search text string, within an original text string, with the supplied replacement text
Cutting Up & Piecing Together Text Strings
CONCATENATE Joins together two or more text strings
LEFT Returns a specified number of characters from the start of a supplied text string
![Page 8: Excel Questions](https://reader035.vdocument.in/reader035/viewer/2022081505/551555fb4a7959af658b466d/html5/thumbnails/8.jpg)
this into text
TEXT Converts a supplied value into text, using a user-specified format
VALUE Converts a text string into a numeric value
Functions to Convert Between Upper & Lower Case
LOWER Converts all characters in a supplied text string to lower case
PROPER Converts all characters in a supplied text string to proper case (ie. the first character in each word is upper case and all other characters are lower case)
UPPER Converts all characters in a supplied text string to upper case
Converting Between Characters & Numeric Codes
CHAR Returns the character that corresponds to a supplied numeric value
CODE Returns the numeric code for the first character of a supplied string
MID Returns a specified number of characters from the middle of a supplied text string
RIGHT Returns a specified number of characters from the end of a supplied text string
REPT Returns a string consisting of a supplied text string, repeated a specified number of times
Information Functions
LEN Returns the length of a supplied text string
FIND Returns the position of a supplied character or text string from within a supplied text string (case-sensitive)
SEARCH Returns the position of a supplied character or text string from within a supplied text string (non-case-sensitive)
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
AND Tests a number of user-defined conditions and returns TRUE if ALL of the conditions evaluate to TRUE, or FALSE otherwise
OR Tests a number of user-defined conditions and
Conditional Functions
IF Tests a user-defined condition and returns one result if the condition is TRUE, and another result if the condition is FALSE
IFERROR Tests if an initial supplied value (or expression) returns an error, and if so the function returns
![Page 9: Excel Questions](https://reader035.vdocument.in/reader035/viewer/2022081505/551555fb4a7959af658b466d/html5/thumbnails/9.jpg)
returns TRUE if ANY of the conditions evaluate to TRUE, or FALSE otherwise
NOT Returns a logical value that is the opposite of a user supplied logical value or expression(ie. returns FALSE is the supplied argument is TRUE and returns TRUE if the supplied argument is FALSE)
a supplied value; Otherwise the function returns the initial value. (New in Excel 2007)
Functions Returning Constant Values
TRUE Simply returns the logical value TRUE
FALSE Simply returns the logical value FALSE
Excel Information Functions
Error Information Functions
ISERROR Tests if an initial supplied value (or expression) returns an error and if so, returns TRUE; Otherwise returns FALSE
ISERR Tests if an initial supplied value (or expression) returns an error (EXCEPT for the #N/A error) and if so, returns TRUEOtherwise returns FALSE
ISNA Tests if an initial supplied value (or expression) returns the Excel #N/A error and if so, returns TRUE; Otherwise returns FALSE
ERROR.TYPE
Tests a supplied value and returns an integer relating to the supplied value's error type
Numerical Information Functions
ISNUMBER
Tests if a supplied value is a number, and if so, returns TRUE; Otherwise, returns FALSE.
ISEVEN Tests if a supplied number (or expression) is an even number, and if so, returns TRUE; Otherwise, returns FALSE.
ISODD Tests if a supplied number (or expression) is an odd number, and if so, returns TRUE;
Other Data Type Functions
ISBLANK Tests if a supplied cell is blank (empty), and if so, returns TRUE; Otherwise, returns FALSE
ISLOGICAL Tests if a supplied value is a logical value, and if so, returns TRUE; Otherwise, returns FALSE
ISTEXT Tests if a supplied value is text, and if so, returns TRUE; Otherwise, returns FALSE
ISNONTEXT
Tests if a supplied value is text, and if it is NOT, returns TRUE; Otherwise, returns FALSE
ISREF Tests if a supplied value is a reference, and if so, returns TRUE; Otherwise, returns FALSE
TYPE Returns information about the data type of a supplied value
General Information Functions
CELL Returns information about the contents, formatting or location of a given cell
![Page 10: Excel Questions](https://reader035.vdocument.in/reader035/viewer/2022081505/551555fb4a7959af658b466d/html5/thumbnails/10.jpg)
Otherwise, returns FALSE.
N Converts a non-number value to a number, a date to a serial number, the logical value TRUE to 1 and all other values to 0
INFO Returns information about the the current operating environment
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
DATE Returns a date, from a user-supplied year, month and day
TIME Returns a time, from a user-supplied hour, minute and second
DATEVALUE
Converts a text string showing a date, to an integer that represents the date in Excel's date-time code
TIMEVALUE Converts a text string showing a time, to a decimal that represents the time in Excel
Current Date & Time
NOW Returns the current date & time
TODAY Returns today's date
Extracting The Components of a Time
HOUR Returns the hour part of a user-supplied time
MINUTE Returns the minute part of a user-supplied time
SECOND Returns the seconds part of a user-supplied time
Performing Calculations with Dates
EDATE Returns a date that is the specified number of months before or after an initial supplied start date
EOMONTH Returns a date that is the last day of the month which is a specified number of months before or after an initial supplied start date
WORKDAY Returns a date that is a supplied number of working days (excluding weekends & holidays) ahead of a given start date
WORKDAY.INTL Returns a date that is a supplied number of working days (excluding weekends & holidays) ahead of a given start date, using supplied parameters to specify weekend days (New in Excel 2010)
DAYS360 Calculates the number of days between 2 dates, based on a 360-day year (12 x 30 months)
NETWORKDAYS Returns the number of whole networkdays (excluding weekends & holidays), between two supplied
![Page 11: Excel Questions](https://reader035.vdocument.in/reader035/viewer/2022081505/551555fb4a7959af658b466d/html5/thumbnails/11.jpg)
Extracting The Components of a Date
DAY Returns the day (of the month) from a user-supplied date
MONTH Returns the month from a user-supplied date
YEAR Returns the year from a user-supplied date
WEEKNUM Returns an integer representing the week number (from 1 to 53) of the year from a user-supplied date
WEEKDAY Returns an integer representing the day of the week for a supplied date
dates
NETWORKDAYS.INTL
Returns the number of whole networkdays (excluding weekends & holidays), between two supplied dates, using parameters to specify weekend days (New in Excel 2010)
YEARFRAC Calculates the fraction of the year represented by the number of whole days between two dates
Excel Lookup and Reference Functions
Functions To Return References to Cell Ranges
ADDRESS Returns a reference, in text format, for a supplied row and column number
INDEX Returns a reference to a cell (or range of cells) for requested rows and columns within a supplied range
INDIRECT Returns a cell or range reference that is represented by a supplied text string
OFFSET Returns a reference to a range of cells that is a specified number of rows and columns from an initial supplied range
Row / Column / Area Information
ROW Returns the current row number of the spreadsheet
Data Lookup Functions
HLOOKUP Looks up a supplied value in the first row of a table, and returns the corresponding value from another row
VLOOKUP Looks up a supplied value in the first column of a table, and returns the corresponding value from another column
LOOKUP Searches for a specific value in one data vector, and returns a value from the corresponding position of a second data vector
GETPIVOTDATA
Extracts data stored in a Pivot Table
CHOOSE Returns one of a list of values, depending on the value of a supplied index number
MATCH Finds the relative position of a value in a
![Page 12: Excel Questions](https://reader035.vdocument.in/reader035/viewer/2022081505/551555fb4a7959af658b466d/html5/thumbnails/12.jpg)
COLUMN Returns the current column number of the spreadsheet
ROWS Returns the number of rows in a supplied range
COLUMNS Returns the number of columns in a supplied range
AREAS Returns the number of areas in a supplied range
supplied array
Other
HYPERLINK Creates a hyperlink to a document in a supplied location.
TRANSPOSE Performs a transpose transformation on a range of cells (ie. transforms a horizontal range of cells into a vertical range and vice versa)
RTD Retrieves real-time data from a program that supports COM automation
Excel Math and Trig Functions
Basic Numeric Information
ABS Returns the absolute value (ie. the modulus) of a supplied number
SIGN Returns the sign (+1, -1 or 0) of a supplied number
GCD Returns the Greatest Common Divisor of two or more supplied numbers
LCM Returns the Least Common Multiple of two or more supplied numbers
Basic Mathematical Operations
SUM Returns the sum of a supplied list of numbers
PRODUCT Returns the product of a supplied list of numbers
POWER Returns the result of a given number raised
Conditional Sums
SUMIF Adds the cells in a supplied range, that satisfy a given criteria
SUMIFS Adds the cells in a supplied range, that satisfy multiple criteria (New in Excel 2007)
Advanced Mathematical Operations
SUMPRODUCT
Returns the sum of the products of corresponding values in two or more supplied arrays
SUMSQ Returns the sum of the squares of a supplied list of numbers
SUMX2MY2 Returns the sum of the difference of squares of corresponding values in two supplied arrays
SUMX2PY2 Returns the sum of the sum of squares of corresponding values in two supplied arrays
SUMXMY2 Returns the sum of squares of
![Page 13: Excel Questions](https://reader035.vdocument.in/reader035/viewer/2022081505/551555fb4a7959af658b466d/html5/thumbnails/13.jpg)
to a supplied power
SQRT Returns the positive square root of a given number
QUOTIENT Returns the integer portion of a division between two supplied numbers
MOD Returns the remainder from a division between two supplied numbers
AGGREGATE
Performs a specified calculation (eg. the sum, product, average, etc.) for a list or database, with the option to ignore hidden rows and error values (New in Excel 2010)
SUBTOTAL Performs a specified calculation (eg. the sum, product, average, etc.) for a supplied set of values
Rounding Functions
CEILING Rounds a number away from zero (ie. rounds a positive number up and a negative number down), to a multiple of significance
CEILING.PRECISE Rounds a number up, regardless of the sign of the number, to a multiple of significance (New in Excel 2010)
ISO.CEILING Rounds a number up, regardless of the sign of the number, to a multiple of significance. (New in Excel 2010)
EVEN Rounds a number away from zero (ie. rounds a positive number up and a negative number down), to the next even number
FLOOR Rounds a number towards zero, (ie. rounds a positive number down and a negative number up), to a multiple of
differences of corresponding values in two supplied arrays
SERIESSUM Returns the sum of a power series
Trigonometry Functions
PI Returns the constant value of pi
SQRTPI Returns the square root of a supplied number multiplied by pi
DEGREES Converts Radians to Degrees
RADIANS Converts Degrees to Radians
COS Returns the Cosine of a given angle
ACOS Returns the Arccosine of a number
COSH Returns the hyperbolic cosine of a number
Factorials
FACT Returns the Factorial of a given number
FACTDOUBLE Returns the Double Factorial of a given number
MULTINOMIAL Returns the Multinomial of a given set of numbers
Random Numbers
RAND Returns a random number between 0 and 1
RANDBETWEEN
Returns a random number between two given integers
Miscellaneous
COMBIN Returns the number of combinations for a
![Page 14: Excel Questions](https://reader035.vdocument.in/reader035/viewer/2022081505/551555fb4a7959af658b466d/html5/thumbnails/14.jpg)
significance
FLOOR.PRECISE Rounds a number down, regardless of the sign of the number, to a multiple of significance (New in Excel 2010)
INT Rounds a number down to the next integer
MROUND Rounds a number up or down, to the nearest multiple of significance
ODD Rounds a number away from zero (ie. rounds a positive number up and a negative number down), to the next odd number
ROUND Rounds a number up or down, to a given number of digits
given number of objects
ROMAN Returns a text string depicting the roman numeral for a given number
ROUNDDOWN Rounds a number towards zero, (ie. rounds a positive number down and a negative number up), to a given number of digits
ROUNDUP Rounds a number away from zero (ie. rounds a positive number up and a negative number down), to a given number of digits
TRUNC Truncates a number towards zero (ie. rounds a positive number down and a negative number up), to the next integer.
Excel Database Functions
Database Functions
DAVERAGE Calculates the average of values in a field of a list or database, that satisfy specified conditions
DCOUNT Returns the number of cells containing numbers in a 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 satisfy specified conditions
DGET Returns a single value from a field of a list or database, that satisfy specified conditions
DMAX Returns the maximum value from a field of a list or database, that satisfy specified
Database Functions
DPRODUCT
Calculates the product of values in a field of a list or database, that satisfy specified conditions
DSTDEV Calculates the standard deviation (based on a sample of a population), of values in a field of a list or database, that satisfy specified conditions
DSTDEVP Calculates the standard deviation (based on an entire population), of values in 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 conditions
![Page 15: Excel Questions](https://reader035.vdocument.in/reader035/viewer/2022081505/551555fb4a7959af658b466d/html5/thumbnails/15.jpg)
conditions
DMIN Returns the minimum value from a field of a 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 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
FV Calculates the future value of an investment with periodic constant payments and a constant interest rate
FVSCHEDULE
Calculates the future value of an initial principal, after applying a series of compound interest rates
NPV Calculates the net present value of an investment, based on a supplied discount rate, and a series of future payments and income
PV Calculates the present value of an investment (ie. the total amount that a series of future payments is worth now)
RECEIVED Calculates the amount received at maturity for a fully invested Security
XNPV Calculates the net present value for a schedule of cash flows
Payment Functions
CUMIPMT Calculates the cumulative interest paid between two specified periods
CUMPRINC Calculates the cumulative principal paid on
Internal Rate of Return Functions
IRR Calculates the internal rate of return for a series of cash flows
MIRR Calculates the internal rate of return for a series of periodic cash flows, considering the cost of the investment and the interest on the reinvestment of cash
XIRR Calculates the internal rate of return for a schedule of cash flows
Asset Depreciation Functions
AMORDEGRC Calculates the prorated linear depreciation of an asset for each accounting period (with depreciation coefficient applied, depending on the life of the asset)
AMORLINC Calculates the prorated linear depreciation of an asset for each accounting period
DB Calculates the depreciation of an asset for a specified period, using the fixed-declining balance method
DDB Calculates the depreciation of an asset for a specified period, using the double-
![Page 16: Excel Questions](https://reader035.vdocument.in/reader035/viewer/2022081505/551555fb4a7959af658b466d/html5/thumbnails/16.jpg)
a loan, between two specified periods
IPMT Calculates the interest payment for a given period of an investment, with periodic constant payments and a constant interest rate
ISPMT Returns the interest paid during a specified period of an investment
PMT Calculates the payments required to reduce a loan, from a supplied present value to a specified future value
PPMT Calculates the payment on the principal for a given investment, with periodic constant payments and a constant interest rate
Duration Functions
COUPDAYBS Calculates the number of days from the beginning of the coupon period to the settlement date
COUPDAYS Calculates the number of days in the coupon period that contains the settlement date
COUPDAYSNC
Calculates 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
DURATION Calculates the annual duration of a security with periodic interest payments
declining balance method, or some other user-specified method
SLN Returns the straight-line depreciation of an asset for one period
SYD Returns the sum-of-years' digits depreciation of an asset for a specified period
VDB Returns the depreciation of an asset for a specified period, (including partial periods), using the double-declining balance method or another user-specified method
Interest Rate Functions
ACCRINT Calculates the accrued interest for a security that pays periodic interest
ACCRINTM Calculates the accrued interest for a security that pays interest at maturity
DISC Calculates the discount rate for a security
EFFECT Calculates the effective annual interest rate
INTRATE Calculates the interest rate for a fully invested security
NOMINAL Calculates the annual nominal interest rate
RATE Calculates the interest rate required to pay off a specified amount of a loan, or reach a target amount on an investment over a given period
Dollar Conversion
![Page 17: Excel Questions](https://reader035.vdocument.in/reader035/viewer/2022081505/551555fb4a7959af658b466d/html5/thumbnails/17.jpg)
MDURATION Calculates the Macauley modified duration for a security with an assumed par value of $100
NPER Returns the number of periods for an investment with periodic constant payments and a constant interest rate
Yield Functions
YIELD Calculates the yield of a security that pays periodic interest
YIELDDISC Calculates the annual yield of a discounted security
YIELDMAT Calculates the annual yield of a security that pays interest at maturity
ODDFYIELD Calculates the yield of a security with an odd first period
ODDLYIELD Calculates the yield of a security with an odd last period
TBILLEQ Calculates the bond-equivalent yield for a treasury bill
TBILLYIELD Calculates the yield for a treasury bill
DOLLARDE
Converts a dollar price expressed as a fraction, into a dollar price expressed as a decimal
DOLLARFR Converts a dollar price expressed as a decimal, into a dollar price expressed as a fraction
Price Functions
PRICE Calculates the price per $100 face value of a security that pays periodic interest
PRICEDISC Calculates the price per $100 face value of a discounted security
PRICEMAT Calculates the price per $100 face value of a security that pays interest at maturity
ODDFPRICE Calculates the price per $100 face value of a security with an odd first period
ODDLPRICE Calculates the price per $100 face value of a security with an odd last period
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 Operators Excel Mathematical Operators - used to perform basic Mathematical operations, such as addition, subtraction, multiplication, division and raising to a power,
OR
![Page 18: Excel Questions](https://reader035.vdocument.in/reader035/viewer/2022081505/551555fb4a7959af658b466d/html5/thumbnails/18.jpg)
the & Excel Operator is used to concatenate text strings
Basic Description
Related Functions :
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_num
- The row number, within the supplied array, that you want the 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)
FALSE - if the function cannot find an exact match to the supplied lookup_value, it should return an error
Examples
Hlookup Example 1
![Page 19: Excel Questions](https://reader035.vdocument.in/reader035/viewer/2022081505/551555fb4a7959af658b466d/html5/thumbnails/19.jpg)
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.
![Page 20: Excel Questions](https://reader035.vdocument.in/reader035/viewer/2022081505/551555fb4a7959af658b466d/html5/thumbnails/20.jpg)
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(or is omitted)
- the #N/A error is likely to be because the smallest value in the lookup row 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 lookup row
if you can't understand why this is, check out Common Problem No. 1 (below).
#VALUE!
- Occurs if either:
- The supplied row_index_num argument is < 1 or is not recognised as a numeric
![Page 21: Excel Questions](https://reader035.vdocument.in/reader035/viewer/2022081505/551555fb4a7959af658b466d/html5/thumbnails/21.jpg)
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. 2The 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. 2Force 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.
![Page 22: Excel Questions](https://reader035.vdocument.in/reader035/viewer/2022081505/551555fb4a7959af658b466d/html5/thumbnails/22.jpg)
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_num
- The column number, within the supplied array, that you want the 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
![Page 23: Excel Questions](https://reader035.vdocument.in/reader035/viewer/2022081505/551555fb4a7959af658b466d/html5/thumbnails/23.jpg)
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.
![Page 24: Excel Questions](https://reader035.vdocument.in/reader035/viewer/2022081505/551555fb4a7959af658b466d/html5/thumbnails/24.jpg)
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(or is omitted)
- the #N/A error is likely to be because the smallest value in the left-hand column of the table_array is greater than the supplied
![Page 25: Excel Questions](https://reader035.vdocument.in/reader035/viewer/2022081505/551555fb4a7959af658b466d/html5/thumbnails/25.jpg)
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
#VALUE!
- Occurs if either:
-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
![Page 26: Excel Questions](https://reader035.vdocument.in/reader035/viewer/2022081505/551555fb4a7959af658b466d/html5/thumbnails/26.jpg)
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], [Item1],[Field2], [Item2],etc
- Up to 126 optional pairs of fields and item names, (ie. The rows and columns headers and individual categories) for which you want the returned value.Note: The item values should be entered as follows:
- 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.
![Page 27: Excel Questions](https://reader035.vdocument.in/reader035/viewer/2022081505/551555fb4a7959af658b466d/html5/thumbnails/27.jpg)
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 Total
Item Type
3 Date Salesperson Digital TV DVD Player
IPod Computer Grand 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" )
![Page 28: Excel Questions](https://reader035.vdocument.in/reader035/viewer/2022081505/551555fb4a7959af658b466d/html5/thumbnails/28.jpg)
- 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".