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 17: National festive days Function

 

1. Create a UDF (User Defined Function)

To create this Function, execute the following steps

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

img33.png

img34.png

= FestivDay( (A1)

This Will Create A new UDF (User Defined Function) with name FestivDay( (A1)we Can use this As we Required. type in Excel the function As = FestivDay( A1), the UDF Comes up in small letter’s to differentiate itself from “tandard Excel Formula,if the day fall’s to National

 

This Code lines will create function FestivDay()

In Cell B1 Type

= FestivDay(A1)

img35.jpg

2. Use Excel Formulas (NOT,OR)

Syntax

=NOT(OR(A1>10,B1>10,C1>10))