Skip to content
- VBA Global Dictionary: Scope, Setup, and Code ExamplesVBA has no built-in global dictionary type, but in Excel for Microsoft 365 on Windows you can create a Scripting.Dictionary object and…VBA & macros
- Excel Formula for Last Updated Date in a Specific CellFor a live current date in Excel, use =TODAY(); for the current date and time, use =NOW(). Neither formula records when a…Formulas & functions
- VBA Get Length of String: How the Len Function WorksTo get the length of a string in VBA, use the Len function: Len(myText) returns the number of characters in the string.…VBA & macros
- Excel Formula for Last 4 Digits: RIGHT and FixesTo return the last four characters from a value in cell A2, use =RIGHT(A2,4). For example, if A2 contains 5551234567, the result…Formulas & functions
- VBA Get Character From String: Mid, Loops & TipsTo get one character from a VBA string by position, use Mid$(text, position, 1). For example, Mid$("Excel VBA", 7, 1) returns V;…VBA & macros
- Excel Formula for the Larger of Two NumbersTo return the larger of two numbers in Excel, use the MAX function. With the values in A1 and B1, enter =MAX(A1,B1);…Formulas & functions
- VBA UserForms: What They Are and How to Use ThemA VBA UserForm is a custom dialog window you build in the Visual Basic for Applications editor and use to collect or…VBA & macros
- Excel Julian Date Formula: Day of Year and MoreFor a date in A2, use =INT(A2)-DATE(YEAR(A2),1,0) to return its day number within the year: January 1 is 1, and December 31…Formulas & functions
- VBA Format Date String: Examples, Patterns, and FixesIn VBA, use Format or Format$ to turn a date value into a text string: for example, Format$(Date, "yyyy-mm-dd") produces a year-month-day…VBA & macros
- Excel Formula for Grouping Data by CategoryIn Excel for Microsoft 365, use UNIQUE to list each category once and FILTER to return the records for a chosen category;…Formulas & functions
- Excel Formula for the Higher of Two Values: MAX or IFTo return the higher of two values in Excel, use the MAX function. If the values are in cells A1 and B1,…Formulas & functions
- VBA For Next Loop: Syntax, Examples, and Common ErrorsA VBA For...Next loop repeats a block of code for a counter that moves through a specified range. In Excel, it is…VBA & macros
- Excel Formula for the Greater of Two Values: MAX or IF?To return the greater of two numeric values in Excel, use =MAX(A2,B2), assuming the values are in cells A2 and B2. MAX…Formulas & functions
- VBA For Loop Negative: How Step -1 WorksYes. A VBA For loop can count downward by using a negative Step, such as For i = 10 To 1 Step…VBA & macros
- Excel FV Formula: How to Calculate Future Value and GrowthIn Excel for Microsoft 365, use the FV function to calculate the future value of regular payments or a starting balance. For…Formulas & functions
- VBA For Loop Backwards: Syntax, Examples, and Common FixesTo make a VBA For loop count backwards, give it a negative Step, such as For i = 10 To 1 Step…VBA & macros
- Excel Formula for a Future Date: Add Days or MonthsIf the starting date is in A2 and the number of days to add is in B2, enter =A2+B2 to return a…Formulas & functions
- VBA For Each Loop: Syntax, Examples, and Common ErrorsA VBA For Each loop repeats an action for every item in a collection or array, without requiring you to manage an…VBA & macros
- Excel Formula to Extract the First Five Digits from D2Assuming D2 contains the text or number you want to search, use =IFERROR(IF(D2="","",LEFT(TEXTJOIN("",TRUE,IFERROR(MID(D2,SEQUENCE(LEN(D2)),1)*1,"")),5)),"") to collect the first five digits found anywhere in…Formulas & functions
- VBA Double Quotes in Strings: How to Escape a QuoteTo include a double quote inside a VBA string, type two double quotes in a row: VBA treats "" inside a string…VBA & macros
- Excel Formula for the First 3 Digits: Text or Numbers?To return the first three characters from a value in cell A2, use =LEFT(A2,3). The result is text, even when the characters…Formulas & functions
- VBA Double Loop: How Nested For Loops Work in ExcelA VBA double loop is a loop inside another loop: the outer loop runs once, and for each pass the inner loop…VBA & macros
- Excel Formula for Finding Matches: A Practical GuideTo find the position of a value, use MATCH with exact-match mode. With the value to find in E2 and the search…Formulas & functions
- Excel Formula for File Path: Get the Workbook LocationIn Excel for Microsoft 365 on Windows, use =CELL("filename",A1) to return the saved workbook’s path, file name, and active sheet name in…Formulas & functions
- VBA Display UserForm: Methods, Examples, and FixesIn Excel VBA, display a UserForm by calling its Show method, such as frmEntry.Show. By default, the form is modal; add vbModeless…VBA & macros
- Excel Formula for File Name: Workbook, Sheet, and PathTo return the current workbook’s file name in Excel, use =TEXTBEFORE(TEXTAFTER(CELL("filename",A1),"["),"]") in Microsoft 365 or Excel 2024. The workbook must have been…Formulas & functions
- VBA Display Array in MsgBox: Safe, Clear ExamplesVBA cannot display an array directly in a MsgBox: first convert its elements to a text string. For a one-dimensional array, use…VBA & macros
- Excel Formula for Extracting Text from a CellTo extract a set number of characters in Excel, use =LEFT(A2,3) when the text is in A2 and you need its first…Formulas & functions
- VBA Dictionary With Multiple Values: Practical MethodsYes. A VBA Scripting.Dictionary can hold multiple values for one key, but each key still maps to a single item: make that…VBA & macros
- Excel Exponential Power Formula: Use the ^ OperatorTo raise a number to a power in Excel, use the caret operator: with the base in A2 and the exponent in…Formulas & functions