Excel VBA formulas for Spreadsheet by Sharath Kumar Peechara - HTML preview

PLEASE NOTE: This is an HTML preview only and some elements such as links or page numbers may be incorrect.
Download the book in PDF, ePub, Kindle for a complete version.

Exercise 3: Standard IF Function

 

1. Create a UDF (User Defined Function)

Use the If Then statement in Excel VBA code lines function to act if a specific condition is met. To create this Function, execute the following steps

  1. Open Excel VBA (Altl + F11)
  2. Insert a New Module
  3. In the Project Explorer, double click on the Module
  4. Add the following code line:

img5.png

This Will Create A new UDF (User Defined Function) with name grade(S),we Can use this As we Required. type in Excel the function = grade(A1) ,the UDF Comes up in small letter’s to differentiate itself from Standard Excel Formula

This Code lines will create function grade ()

In Cell B1 Type

= grade(A1)

img6.jpg

2. Use Excel Formulas (IF) Syntax

IF(logical_test, value_if_true, [value_if_false])

=IF(B1>79,"Excellent",IF(B1>49,"Good",IF(B1>19,"Average",IF(B1>1,"Worst","N/a"))))

Find Your Next Great Read

Describe what you're looking for in as much detail as you'd like.
Our AI reads your request and finds the best matching books for you.

Showing results for ""

Popular searches:

Romance Mystery & Thriller Self-Help Sci-Fi Business