Category Archives: Functions

How to Split Spreadsheets in Excel Using VBA

Why Separate Sheets? An Excel workbook can have several worksheets. There’s a chance that those different sheets contain information that is unrelated and needs to be separated into separate workbooks. Problem: For example, imagine a corporate training hub preparing a document on training sessions planned

How to Find an Exact Match Using VBA

The Search Feature in Microsoft Excel Before digging into how to look for exact matches in VBA, I’ll give you some context with the easiest way to accomplish this goal — the search function in Excel. Microsoft Excel provides us with an excellent feature that

How to Use IfError in VBA and Excel

Errors Happen We may come across several functions in programming languages. In VBA, we are prone to encounter errors like:  Syntax errors Compile time errors Runtime errors These are errors in code which can be handled using error handling methods. For example, you can see

Using the Match Function in VBA and Excel

What is a Match Function? The match function in MS Excel is one of the useful built-in lookup functions that work like Vlookup, Hlookup, and the Index function to return the position of exact or similar matches of the lookup value found in an array

Use Any Formula: Worksheetfunction in VBA

Formulas in EXCEL Microsoft Excel offers several built-in functions that can be used as formulas in Excel worksheets. It displays the categories of functions available in the Insert Function window, as seen in the image below: Usage of Formula in an Excel Sheet Just like

Using Exit Function in VBA

To start with, make sure you have a good understanding of what a function is and how it works. You can get a great overview in my articles here: What is “You’ve Entered too Many Arguments”? How Do You Fix “Compile Error: Argument not optional”?

Call Sub vs. Functions in VBA

Introduction In the MS Excel’s Visual Basic Editor, Sub is a statement, like a function fun(), that performs a specific task. A sub is a piece of code that performs a specific task and does not return a result. The purpose of a subroutine is to

Cross Products with Excel and VBA

Microsoft Excel does not have the built-in worksheet functions to calculate the cross product of two vectors. Therefore, some techniques are required to do the calculation — either by setting up your own formula in a worksheet or by creating a custom VBA function. The