Excel has many functions for different operations. Inside the parenthesis of the functions, we put some inputs for the desired operation that we want to perform. These inputs inside the parenthesis are called the arguments. In this article, we will get to know what is an argument in Excel. We will also be familiarized with different types of arguments.
Functions with a Single Argument
Arguments are mostly referred to individual cells but it also includes cell ranges. Below is an example of a function with a single argument.
Here we used the function UPPER which takes text-string as an argument. It accepts a single argument as input and converts the lower case letter into the uppercase letter.
Here the argument is a text-string placed in cell A1.
Functions with Multiple Arguments
If you want to use multiple arguments in a function you need to use coma in between them. Suppose you want to calculate the average and sum of two columns. You can either use the single argument with range or you can use two arguments where you can define the two ranges separately like, =AVERAGE(A1:A6,B1:B6) & =SUM(A1:A6,B1:B6).
Here, (A1: A6, B1: B6) are the arguments for AVERAGE and SUM functions. As there are multiple arguments, they are separated by commas in between them.
You can see the below example which uses three arguments. The function is the TIME function and it uses hour, minutes, and seconds as arguments.
Functions with Optional Arguments
There are some functions that use some arguments as optional.
Like the NETWORKDAYS function.
This is the syntax of NETWORKDAYS function:
NETWORKDAYS(start_date, end_date, [holidays])
The green-colored [holidays] argument is the optional one here. An optional argument is put into the third bracket in Function syntax.
Here we used the formula =NETWORKDAYS(A2,B2,7) to calculate the number of working days between two dates. We used the number 7 as an optional argument which indicates that Saturdays and Fridays are considered as weekends.
If we write this formula in this way =NETWORKDAYS(A2,B2, without the 3rd argument (the optional one), this formula will give you the total workdays between two dates considering Saturdays and Sundays as the weekends.
Functions with No Arguments
Though most functions use arguments, Excel has some predefined functions that don’t use any arguments, such as RAND(), TODAY(), and NOW().
Functions As Arguments (Nesting Functions)
Functions can be used as arguments under a different function. This process is known as the nesting functions. For example, we want to add 5 years to a specific date to find out the resultant date. we will be using the formula =DATE(YEAR(A2) + B2, MONTH(A2), DAY(A2)). Here the main function is DATE. YEAR, MONTH, and DAY are the other functions that are nested in the DATE function. These additional functions are accepted as arguments for the DATE function. Like the YEAR(A2)+B2 has been used as the first argument of the DATE function.
Finding The Value of Nested Functions
To find the values of the nested functions which are used as arguments for a different function you just need to press F9 after pressing the argument of the main function. Follow the pictures below to see what exactly is done.
Here firstly we select the first argument of the main function. In the second picture, we just press the F9 of the keyboard button. It showed the specific result for that argument. You can even use this procedure for single functions also.
How to Insert Arguments in Excel
There are two ways in which you can insert arguments in Excel.
- Typing the function directly in a cell
- Using Excel function Argument dialogue box.
Read More: What You Can Do with VBA
Typing Function Directly in a Cell
In this way, if you want to use any function in any specific cell, select that cell and start writing the function name with a “=” sign in the beginning. While you write the function name in Excel you will see what kind of arguments it can accept within the parenthesis. The picture below shows how to write a function with arguments in Excel.
Using Excel Function Argument Dialogue Box
It`s a good practice to use the Excel function argument dialogue box to write the function name with arguments. To find the function argument dialogue box, press on the formulas tab on top and select any formula from there you will see a box will appear. Here in this example, I showed the NETWORKDAYS function with its available arguments.
The best part of using the function argument dialogue box is, you can insert the arguments by knowing them properly. So before inserting any arguments, you actually know what you are performing.
Types of Arguments in a Function
Excel accepts many different kinds of inputs as arguments depending on the functions you want to use. Most of the arguments in Excel are numeric data as people vastly use Excel for numeric calculations. But it also accepts other data types. The types of arguments that are used in Excel are given below.
- Numeric data (=SUM(5,10))
- Text-string data (=UPPER(“siam”))
- Boolean values (=OR(1+1=2))
- Error Values (=ISERR(#VALUE!))
- Other functions (=DATE(YEAR(A2) + B2, MONTH(A2), DAY(A2)))
Excel VBA Functions with No Arguments
In Excel VBA, you can write a function with as many arguments as you need basis. But it is also possible to write a function without an argument.
See the following procedure:
Choose File ➪ Options ➪ General to see this section. The following is a simple example of a custom function that has no arguments. This function returns the UserName property of the Application object. This name appears in the Personalize your copy of the Microsoft Office section of the Excel Options dialog box. This function is very simple, but it is the only way you can get the username to use in a worksheet cell or formula.
Function OfficeUserName() 'Returns the name of the current user OfficeUserName = Application.UserName End Function
When you enter the following formula into a worksheet cell, the cell displays the name of the current user:
When you use a function with no arguments, you must include a set of empty parentheses.
Happy Excelling ☕