How to create Excel function/formula?

This is the reason why the power of Excel when combined with VBA is almost limitless. When we can’t found any Excel function that suite our need, we can built it easily using Excel VBA.

If Excel macro or SUB procedure is easily created using Record Macro button, and usually build to simplify a complex process to became one simple push button or call, then an Excel function build to return a value from any kind of calculation and can be use and invoke as a formula.

For example, we can create a simple Excel function to get the last date of the month with date as parameter.

Public Function LASTDATEOFMONTH(ByVal TheDate As Variant) As Date
   Dim nLastDay As Integer
   nLastDay = DatePart("d", DateAdd("d", -1, DateAdd("m", 1, DateAdd("d", _
     -DatePart("d", TheDate) + 1, TheDate))))
   LASTDATEOFMONTH = DateSerial(Year(TheDate), Month(TheDate), nLastDay)
End Function

See the following result.

Last Date Of Month Excel Formula

The result of the formula shows us that the last date of this month is June 30, 2008.

Using Excel function, we can create any kind of specific formula that’s not available in Excel and need to be used for several time on our Excel project.

This entry was posted in Excel Formula and tagged . Bookmark the permalink.

933 Responses to How to create Excel function/formula?

  1. Pingback: study managing your online reputation

  2. Pingback: Apple Mac Mini

  3. Pingback: bad credit mobile phones

  4. Pingback: restaurant franchise opportunities

  5. Pingback: Last Minute Flights Cheap

  6. Pingback: link tracking plugin

  7. Pingback: pedestrian car accidents

  8. Pingback: Creation Site Internet Annecy

  9. Pingback: cancer treatment florida

  10. Pingback: Juegos de futbol online gratis

  11. Pingback: Digital Cameras

  12. Pingback: Electric Airsoft Guns

  13. Pingback: Immobilier Concarneau

  14. Pingback: payday advances reviews

  15. Pingback: beats studio

  16. Pingback: address

  17. Pingback: this month

  18. Pingback: ulta coupons 2012

  19. Pingback: how to make twins baby

  20. Pingback: small blue arrow

  21. Pingback: dog sofas

  22. Pingback: top social marketing companies

  23. Pingback: blog

  24. Pingback: www

  25. Pingback: Online Penny Auctions

  26. Pingback: in english

  27. Pingback: click for payday cash loans

  28. Pingback: go there

  29. Pingback: Red Wines

  30. Pingback: cumming tree removal

  31. Pingback: intangible

  32. Pingback: company web site

  33. Pingback: Zithromax Drug Risks

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>