Excel VBA String Functions: SPLIT, JOIN, CONCATENATE Excel VBA Functions to Split a String into Substrings, and Join an Array of Substrings to form a String, with Examples. Also refer Related Link: Excel VBA String Functions: LEFT, RIGHT, MID, LEN, REPLACE, INSTR, INSTRREV —————————————————————– Contents: Split Function (VBA) Join Function (VBA) Concatenate with & (Worksheet...

# Tag: Excel Tips

## Excel VBA String Functions: LEFT, RIGHT, MID, LEN, REPLACE, INSTR, INSTRREV

Excel VBA String Functions: Excel VBA String Functions for Finding and Replacing Text, with Examples: LEFT, RIGHT, MID, LEN, REPLACE, InStr & InStrRev Functions ——————————————————- Contents: LEFT Function (Worksheet / VBA) RIGHT Function (Worksheet / VBA) MID Function (Worksheet / VBA) LEN Function (Worksheet / VBA) REPLACE Function (Worksheet) REPLACE Function (VBA)...

## Automate Outlook using vba: Sending Email from Excel using Outlook

Automate Outlook using vba: Sending Email from Excel using Outlook ———————————————————————————————— Contents: Automate Outlook using vba Send text and also contents from the host workbook’s worksheet range as Mail Body, and add an attachment with the mail, using Early Binding Send the Host Workbook as an attachment with the mail, using Early Binding...

## Automate Microsoft Word from Excel, using VBA

Automate Microsoft Word from Excel, using VBA ——————————————————————— Contents: Automating an Office Application Practical Examples of Automating Word from Excel ——————————————————————— Automation is a process by which one application communicates with or controls another application. This can be done in two ways: Early Binding and Late Binding. Binding is a process where you assign an...

## Automate Microsoft PowerPoint from Excel, using vba, Run a Slide Show

Automate Microsoft PowerPoint from Excel, using vba, Run a Slide Show ————————————————————————————————————— Contents: Automate Microsoft PowerPoint from Excel Create a new PowerPoint ppt of 3 slides with sound effect, and run a slide show, using Early Binding Create a new PowerPoint ppt of 4 slides with sound clips and chart, run & view...

## Automate Microsoft Outlook from Excel, using VBA

Automate Microsoft Outlook from Excel, using VBA ————————————————————————————————————————————— Contents: Create a new instance of the Outlook application and Create an instance of a NameSpace object variable Reference Existing Outlook Folders and Create New Folders, in Automation Create New Outlook Items and Reference Outlook Items, in Automation ————————————————————————————————————————————— In this section it is...

## Refresh Excel Pivot Table and Cache of PivotTable, using VBA

Refresh Excel Pivot Table and Cache of PivotTable, using VBA Refresh Data in a PivotTable report: You have different ways to refresh and update data in a PivotTable report with any changes made in the source data. This section explains how to update or refresh a PivotTable report, with VBA code. Related...

## Create & Customize Excel Pivot Table Charts, using VBA

Create & Customize Excel Pivot Table Charts, using VBA Related Links: 1. Create an Excel Pivot Table report using VBA 2. Referencing an Excel Pivot Table Range using VBA 3. Reference Pivot Fields and Pivot Items in an Excel Pivot Table, using VBA 4. Excel Pivot Table Address, Location, Move & Copy using VBA 5....

## Reference Pivot Fields and Pivot Items in an Excel Pivot Table, using VBA

Reference Pivot Fields and Pivot Items in an Excel Pivot Table, using VBA This section explains how to access, reference, select or use Pivot Fields and Pivot Items in a Pivot Table, viz. Pivot Field, Column Field, Row Field, Data Field, Page Field, Pivot Items in a Field, Hidden Fields, … Related Links: 1. Create...

## Excel Pivot Table Address, Location, Move & Copy using VBA

Excel Pivot Table Address, Location, Move & Copy using VBA This section explains how to get the Address of a PivotTable in a worksheet; Move PivotTable to a new location; Copy a PivotTable and paste as values or paste as a PivotTable. Related Links: 1. Create an Excel Pivot Table report using VBA 2. Referencing...

## Referencing an Excel Pivot Table Range using VBA

Referencing an Excel Pivot Table Range using VBA This section explains how to access, reference, select or use a specific part of a Pivot Table, be it the Field or Data Labels, Row or Column Ranges, the Data or Values Area, the Page Area, specified cells or range in a PivotTable report or the entire...

## Excel Pivot Tables Grouping: Group Items, Group Data and Group Date Values, using VBA

Excel Pivot Tables Grouping: Group Items, Group Data and Group Date Values, using VBA You can create a group containing the selected items, in the Rows & Columns Areas of a PivotTable report. Grouping data bunches rows or columns the way you want and which might not be possible with the PivotTable tools like sorting...

## Excel Pivot Tables: Insert Calculated Fields & Calculated Items, Create Formulas using VBA

Excel Pivot Tables: Insert Calculated Fields & Calculated Items, Create Formulas using VBA Related Links: 1. Create an Excel Pivot Table report using VBA 2. Referencing an Excel Pivot Table Range using VBA 3. Reference Pivot Fields and Pivot Items in an Excel Pivot Table, using VBA 4. Excel Pivot Table Address, Location, Move &...

## Excel Pivot Tables: Summary Functions, Custom Calculations & Value Field Settings, using VBA

Excel Pivot Tables: Summary Functions, Custom Calculations & Value Field Settings, using VBA Related Links: 1. Create an Excel Pivot Table report using VBA 2. Referencing an Excel Pivot Table Range using VBA 3. Reference Pivot Fields and Pivot Items in an Excel Pivot Table, using VBA 4. Excel Pivot Table Address, Location, Move &...

## Excel Pivot Tables: Filter Data, Items, Values & Dates using VBA

Excel Pivot Tables: Filter Data, Items, Values & Dates using VBA Related Links: 1. Create an Excel Pivot Table report using VBA 2. Referencing an Excel Pivot Table Range using VBA 3. Reference Pivot Fields and Pivot Items in an Excel Pivot Table, using VBA 4. Excel Pivot Table Address, Location, Move & Copy using...

## Excel Pivot Tables: Sort Fields, Values & Dates, use Custom Lists, with VBA

Excel Pivot Tables: Sort Fields, Values & Dates, use Custom Lists, with VBA Related Links: 1. Create an Excel Pivot Table report using VBA 2. Referencing an Excel Pivot Table Range using VBA 3. Reference Pivot Fields and Pivot Items in an Excel Pivot Table, using VBA 4. Excel Pivot Table Address, Location, Move &...

## Create an Excel Pivot Table report using VBA

Create an Excel Pivot Table report using VBA Related Links: 1. Create an Excel Pivot Table report using VBA 2. Referencing an Excel Pivot Table Range using VBA 3. Reference Pivot Fields and Pivot Items in an Excel Pivot Table, using VBA 4. Excel Pivot Table Address, Location, Move & Copy using VBA 5. Excel...

## 200-Year Calendar in Excel VBA, Free Download

200-Year Calendar in Excel VBA The Calendar has been created with vba code, in excel. It spans 2 centuries, covering years 1900 to 2100. Select the year from the drop-down list (yellow color cell), and the Calendar will auto-generate for that year, showing all 12 months. See below for a snapshot, and...

## Excel VBA Arrays: One-Dimensional & Multi-Dimensional, Dynamic Arrays, ReDim Statement, Lower & Upper Bound, 200-Year Calendar in Excel, ParamArray

Excel VBA Arrays: Declaring Arrays, One-Dimensional and Multi-Dimensional Arrays, Fixed-Size and Dynamic Arrays, ReDim Statement, Lower Bound and Upper Bound, Array Size, Create a 200-Year Calendar with Excel VBA, ParamArray (Parameter Array) ————————————————————————————————————— Contents: VBA Arrays Declare Arrays, Sizing an Array, Determining the Upper and Lower Bounds One-Dimensional and Multi-Dimensional Arrays Fixed-size and Dynamic Arrays;...

## Excel UserForm Controls – Image and RefEdit; use LoadPicture property with GetOpenFilename Method

UserForm Controls – Image and RefEdit UserForm acts as a container in which you add multiple ActiveX controls, each of which has a specific use and associated properties. By itself, a UserForm will not be of much use unless ActiveX controls are added to it which are the actual user-interactive objects. Using ActiveX Controls on...

## Excel UserForm Controls – ScrollBar and SpinButton; create Mortgage Calculator using ScrollBar

UserForm Controls – ScrollBar and SpinButton UserForm acts as a container in which you add multiple ActiveX controls, each of which has a specific use and associated properties. By itself, a UserForm will not be of much use unless ActiveX controls are added to it which are the actual user-interactive objects. Using ActiveX Controls on...

## Excel UserForm Controls – Frame, MultiPage and TabStrip; group OptionButtons; create a wizard using MultiPage control

UserForm Controls – Frame, MultiPage and TabStrip UserForm acts as a container in which you add multiple ActiveX controls, each of which has a specific use and associated properties. By itself, a UserForm will not be of much use unless ActiveX controls are added to it which are the actual user-interactive objects. Using ActiveX Controls...

## Excel UserForm Controls – CheckBox, OptionButton and ToggleButton

UserForm Controls – CheckBox, OptionButton and ToggleButton UserForm acts as a container in which you add multiple ActiveX controls, each of which has a specific use and associated properties. By itself, a UserForm will not be of much use unless ActiveX controls are added to it which are the actual user-interactive objects....

## Excel UserForm Controls – ComboBox and ListBox: AddItem Method, BoundColumn, List Property, ListIndex, RowSource, Selected Property, …

UserForm Controls – ComboBox and ListBox ———————————————————- Contents: Difference between ListBox and ComboBox Key Properties of ComboBox and ListBox Add Items/Data to (Populate) a ListBox or ComboBox Extract ListBox & ComboBox Items, with VBA Delete ListBox rows using the RemoveItem Method ———————————————————- UserForm acts as a container in which you add multiple...

## Excel UserForm Controls – Label, TextBox and CommandButton

UserForm Controls – Label, TextBox and CommandButton UserForm acts as a container in which you add multiple ActiveX controls, each of which has a specific use and associated properties. By itself, a UserForm will not be of much use unless ActiveX controls are added to it which are the actual user-interactive objects. Using ActiveX Controls...

## UserForms in Excel VBA – UserForm Basics; Add Controls dynamically at run-time using the Add Method; UserForm Controls (A Snapshot)

UserForms in Excel VBA – UserForm Basics; Add Controls dynamically at run-time using the Add Method; UserForm Controls (A Snapshot) ———————————————————————– Contents: Excel UserForms Create a UserForm UserForm Controls – A SnapShot UserForm Basics Add Controls to a UserForm ———————————————————————– Note: In below given examples, vba codes are required to be entered in the Code...

## Conditional Statements in Excel VBA – Select…Case Statement (VBA)

Conditional Statements in Excel VBA Related Link: If…Then…Else Statements (VBA). There are primarily two Conditional Statements in VBA: If…Then…Else Statements and Select…Case Statement. In both of these, one or more conditions are evaluated and a block of code is executed depending on the result of the evaluation. Select…Case Statement (VBA) If…Then…Else Statements (VBA) ———————————————————————————————– Contents:...

## Conditional Statements in Excel VBA – If…Then…Else Statements (VBA)

Conditional Statements in Excel VBA Related Links: 1. Excel IF Function and IF Statements. 2. Select…Case Statement (VBA). There are primarily two Conditional Statements in VBA: If…Then…Else Statements and Select…Case Statement. In both of these, one or more conditions are evaluated and a block of code is executed depending on the result of the evaluation....

## Excel VBA Loops, with examples. For Loop; Do While Loop; Do Until Loop.

Excel VBA Loops, with examples. For Loop; Do While Loop; Do Until Loop. ——————————————————————————————– Contents: The For Loop The For … Next Statements The For Each … Next Statements The Do While Loop The Do While … Loop Statements; The Do … Loop While Statements The Exit Do Statement The Do Until Loop The Do...

## Count Once for Occurrence of a Value in all columns of Same Row

Count Occurrences in one or both Columns, consider Once if Occurrence in Same Row of 2 columns Count Occurrences of a Value in Whole or in Part: (i) Count Once if Occurrence in Same Row of One or Both columns or (ii) Count Twice if Occurrence in Both Columns Column E COUNTS Occurrences...

## AVERAGE of Non Contiguous Cells which are Unevenly Distributed

AVERAGE of Non Contiguous Cells which are Unevenly Distributed AVERAGE of Non Contiguous Cells which are Unevenly Distributed Cell D9 formula: Average 6 Non Contiguous Cells which are Unevenly Distributed (A2, A4, A5, A7, A8, A10) having values greater than zero. ———————————————————————————————– Average Non-Contiguous Cells, Unevenly Distributed Cell D9 formula: Average 6...

## Case Sensitive Vlookup in Excel; Finding the 1st, 2nd, nth or last occurrence of the Lookup Value

Case Sensitive Vlookup in Excel; Finding the 1st, 2nd, nth or last occurrence of the Lookup Value Related Links: 1. Excel VLOOKP Function, with examples. 2. Left Lookup with VLookup Excel function. 3. Left Lookup, with Index, Match & Offset Excel functions. 4. Vlookup Multiple Values – Return MULTIPLE corresponding values for ONE Lookup Value....

## Count Uniques, Condition in One or Both Columns

Count Values Once (Unique) or as many times they Occur, Condition in Either 1 or Both Columns Count Values where Multiple Occurrences are Counted Once (Unique values) for Condition of “Yes” in Either 1 or Both Columns Cell E4: Count number of Unique Names in column A (Multiple Occurrences are Counted Once), if Either...

## Count Cells in Non-Contiguous Ranges, where a value occurs in whole or in part

Count cells where a value appears atleast once (in whole or as part of a string), in Multiple Non-Contiguous Ranges Related Links: 1. Excel VLOOKP Function, with examples. 2. Left Lookup with VLookup Excel function. 3. Left Lookup, with Index, Match & Offset Excel functions. 4. Vlookup Multiple Values – Return MULTIPLE corresponding values for...

## Count Unique Values matching any one of the Multiple values

Count Unique Values where other column values Match ANY of the Array values Count Unique column A values (Multiple Occurrences of a Value are Counted Once) where column B values Match ANY of the Array values (ie. Array Criteria Match) Column G formulas COUNT Unique column A values where column B values Match...

## Countif Multiple Criteria, relate Criteria to a Value, return SUM

Count Occurrences of Multiple Criteria in a Column, relate each Criteria to a Number and return SUM Countif with Multiple Criteria – multiply each occurrence with a value corresponding to the respective Criteria and return SUM Cell D7 formula: Count occurrences of “Apple” (C2), “Banana” (C3) & “Pear” (C4) in col A, return...

## Unique List from Single Column, Skip Specific Values

Extract Unique List from a Single Column (Multiple Occurrences Appear only Once) – Skip Specific Value(s) Return Unique List of Values from a Single Column, skipping Specific Values Column A values appear either once (Unique) or multiple times (Duplicate) – these are extracted to appear ONLY ONCE, Skipping Specified Value(s). In...

## Count Unique Names, where Name corresponds to Multiple Values

Count Unique Names, where each Name corresponds to Multiple Values Count Unique Names (Multiple Occurrences of a Name are Counted as One) in column, where each Name corresponds to specific Multiple Values Cell F6: Count Unique Names in column A, having corresponding column B values of both cells E2:E3 (ie. “ABC” & “KLM”)....

## Split Names – Extract First, Middle & Last Names in Separate Cells

Split Names – Extract First, Middle & Last Names in Separate Cells Extract First Name, Middle Name & Last Name(s) in separate cells, from Full Name, where each name is separated with a Space. 2nd cell to contain the excess Middle Names, where there are more than 3 Names separated with Space Cell...

## Unique List Appearing in One Column and Not in Other

Return Unique List of values which appear only in One Column and NOT the other – or Unique List from Both Columns Return Unique List of Values from a Column which do not appear in the Other Column Column D: Extract Unique List of values from column A (each column A value...

## Count Uniques, Multiple AND / OR Conditions

Count Unique values in a column, subject to Multiple Conditions – AND / OR Count Unique values in column A subject to multiple AND/OR conditions Cell J2 formula – Count Unique values in column A subject to multiple AND/OR conditions: (i) If ANY column B, D or F has “Y” (ie. if atleast...

## Sumif to Exclude Cells Hidden by a Filter

SUMIF using SUBTOTAL function to Exclude Cells Hidden by a Filter Sumif / Countif using SUBTOTAL function to Exclude / Include Cells Hidden by a Filter. Cell D6 formula: SUMIF to EXCLUDE cells hidden by using Filter. ———————————————————————————————– SUMIF Exclude Hidden Filtered Rows Cell D6 formula SUMIF to EXCLUDE cells...

## Extract Text after Last Blank Space in a String

Extract all Text after Last Blank Space in a cell String Extract Text after Last Blank Space in a String. Cell D12 formula: Cell D12 formula Extracts all Text after last blank space in cell A12 string. ———————————————————————————————– Extract Text After Last Space Cell D12 formula: Extracts all Text after last blank space in...

## Unique List, Sorted in Ascending Order, Appearing in One Column and Not in Other

Return Unique List of values, Sorted in Ascending Order, which appear only in One Column and NOT the other Return Unique List of values, Sorted in Ascending Order, which appear only in One Column and NOT the other Column D: List column A values which do not appear in column B, duly sorted...

## Count Rows containing Multiple specified Values

Count Number of Rows in a Range where Multiple Values appear atleast once in the Same Row Count Number of Rows, wherein Multiple Specified Values appear in a Row Cell K3 formula Counts Number of Rows in a Range where Multiple Values appear atleast once in the Same Row. Cell K3: Number of rows...

## Position of First Number in a String

Position of 1st Occurrence of a Number in a cell string Position of 1st Number in String; Extract String to the Left of 1st Number / Starting from 1st Number. Cell C2 formula: Returns the Position of First Number in Cell A2 String. ———————————————————————————————– Position of 1st Number in String ...

## Extract Unique sub-strings of 1st 5 Characters from each column cell

Extract Unique List from a Column: (i) Fixed Length of 1st 5 Characters of each cell string; or (ii) Variable Length of Characters in each cell Preceding the 1st “-” (Dash) Extract a Unique List of Codes from column cells: (i) Fixed Length of 1st 5 Characters; (ii) Variable Number of Characters...

## Count Maximum Number of Consecutive Occurrences of a Value

Count Maximum Number of Consecutive Occurrences of a value in a Column Count Maximum Number of Consecutive Occurrences of a value in a Column Cell C3 formula Counts Maximum Number of Consecutive Occurrences, of a value in a Column – Maximum Consecutive Occurrences of the number 5 (cell B3 value) in column A. ...

## SUMIF with Date Range, Multiple Month Names / Numbers & Year

SUMIF with Date Range, Multiple Month Names / Numbers & Year Return SUM of values corresponding to One or Multiple Months, Date Range, and Multiple Names – using SUM, SUMIFS or SUMRODUCT. Cell F6 formula: Return SUM of column C values, where column A month numbers are either 4, 1, or...

## Extract Text After Last Occurrence of a Number in a String

Extract Sub-String After Last Occurrence of a Number / Numerical in a String Extract All Characters starting After the Last occurrence of a Number (ie. 0 to 9) till the end. Cell B2 formula: Extracts all Text starting After and to the Right of the Last occurrence of a Number (ie. 0 to...

## Extract Values which appear ONLY once, from a Column

Extract Values which appear ONLY once (ie. Unique Values) from a Column Only those values which appear ONCE in a Column are extracted. Column A values appear either once (Unique) or multiple times (Duplicate) – only those values which appear ONCE are extracted in columns B; Enter Non-Array formula in...

## Count Groups of Consecutive Positive Values

Count Groups of Consecutive Positive or Negative or Zero Values Count Groups of Consecutive Positive Values Column C formulas Count Groups of Consecutive Positive / Negative / Zero Values; Average (or Maximum) Number of Cells in Positive / Negative / Zero Value Groups. Cell C3 Formula: Count Groups of Consecutive Positive Values in...

## SUM Max values of Each Row, in a Multiple Column Range

SUM Max values of Each Row, in a Multiple Column Range Return SUM of Max values in Each Row, for a Multiple Column Range. Cell E4 formula: Determines the MAX value of each row in the 2 column range A2:B10, and returns the SUM of each of these MAX values. ...

## Extract the Number Preceding Specific Text in a String

Extract the Number immediately Preceding Specific Text in a String Extract the “Number” or “Alphanumeric Sub-string”, immediately Preceding Occurrence of a specific text (“no”) within a String. Cell C2 formula: Extract the “Number” or “Alphanumeric Sub-string”, immediately Preceding Occurrence of the Text “no” in cell A2 string. ———————————————————————————————– Extract Number Before Specific...

## Count Continuous Non-Blank cells which appear Last

Count Number of Continuous Non-Blank cells which appear Last Count the number of Continuous Non-Blank cells which occur last in the row (ie. the last group of non-blank cells) Column A & B formulas Count the number of Continuous Non-Blank cells which occur last in the row (ie. the last group of non-blank...

## SUM Cell values containing any of the Multiple Values in Full or in Part

SUM Cell values containing any of the Multiple Values in Full or in Part SUMIF – SUM corresponding column B cells where column A cells contain any of the Multiple Values (C2:C5) in Full or in Part. Cell E8 formula: Return SUM of corresponding column B cells, where column A cells contain any...

## Extract a Sorted List of Unique values in a column

Return Sorted Unique List of Values from Column having only Text or only Numbers Sort Column values in Ascending / Descending Order, Retain Duplicates or Extract only Once (ie. Uniques) Column F: Extracts Uniques & Sorts column E values in Ascending order – column E can have ONLY Numbers. Enter Array formula...

## Count Rows with occurrence of atleast one number

Count Number of Rows with occurrence of atleast one 1 Count Number of Rows in a Multi Column-Row Array, having occurrence of atleast one 1 If a row in the range A2:F20 contains atleast a single 1, it is considered and counted. Even if a row contains multiple 1s, it is counted as...

## SUM of – Last 12 values in a Column, Largest 5 out of Last 12 values, last 12 values Excluding Highest / Lowest

SUM of – Last 12 values in a Column, Largest 5 out of Last 12 values, last 12 values Excluding Highest / Lowest SUM of Last 12 values in a Column; Sum Largest 5 out of Last 12 values; SUM last 12 values Excluding Highest / Lowest values. Cell F3 formula: Return SUM...

## Position of Last Numeric in a String

Position of Last Occurrence of a Numeric in a cell string Position of 1st or Last Numeric character in an AlphaNumeric String. Cell E2 formula: Returns the Position of Last Numeric in Cell A2 String. ———————————————————————————————– Position of Last Numeric in a String Cell E2 formula: Returns the Position of 1st Numeric character...

## Rank & Sort Column Values, Ignoring Error Values

Rank & Sort Numbers in a Column, Ignoring Error Values Rank & Sort Column Numbers, Skipping Error Values Column B: Ranks column A values, Ignoring Error values, in Descending Order (high to low). Column A contains numbers, and also error values (#N/A, #DIV/0!, etc), in random order. Enter Array formula (Ctrl+Shift+Enter) in cell...

## Position of First Text Character in a String

Position of 1st Occurrence of a Text Character in cell string Position in AlphaNumeric String of 1st Text Character, Last Text Character, 1st Letter (A-Z), Last Digit Preceding 1st Text Character. Cell B2 formula: Returns the Position of 1st Text (Non-Numerical) Character in cell A2 String. ———————————————————————————————– Position of 1st Text...

## Count Multiple Occurrences of Array Values

Count Multiple Occurrences of Array Values in a Range Count Multiple Occurrences of Array Values in a Range Cell E11 formula: Counts Occurrences of column B values in column A (Unique column B values are counted as many times each appears in column A). Unique column B values are counted as many times...

## SUM Non-Contiguous Ranges of a Column – SUM EACH block of consecutive cells

SUM Non-Contiguous Ranges of a Column – SUM EACH block of consecutive cells, starting from specific position, & skip specific number of cells SUM EACH of the Non-Contiguous Blocks of consecutive number of cells, with a specified start position, after skipping specific number of consecutive cells Cell D2 formula: In consecutive cells of...

## Split Values into Multiple Equal Groups

Split Values into Multiple Equal Groups / Ranks Assign Column Values into Groups, with Group 1 having Largest Values & Group 5 Lowest Values Column Values are divided equally between Groups, each group is ranked as per column values, Group 1 having Largest Values & Group 5 Lowest Values. Column...

## Count number of Cells containing Specific Letter(s)

Count the number of Cells containing Specific Letters / Characters Related Links: 1. Excel VLOOKP Function, with examples. 2. Left Lookup with VLookup Excel function. 3. Left Lookup, with Index, Match & Offset Excel functions. 4. Vlookup Multiple Values – Return MULTIPLE corresponding values for ONE Lookup Value. Count the number of Cells containing Specific Letter(s)...

## Assign separate Values to Non-Contiguous Cells and return SUM

SUM – Assign separate Values to Non-Contiguous Cells and return SUM SUM – Assign separate Values to Non-Contiguous Cells in a column, and return SUM Cell E4 formula: Check ALL cells in the range A2:A10 for “Yes” & return SUM: if 2nd or 8th cells are “Yes” add 10 for each; if any other...

## Average of first 10 values in a column, Ignore Error Values

Average of first 10 values in a column, Ignore Error Values, Exclude / Include Zeros & Blank Cells Average of first 10 values in a column, Ignore Error Values Cell C8 formula: Average of the first 10 values in column A, ignore errors, includes zeros, excludes blank cells. ———————————————————————————————– Average 1st 10...

## SUM Largest 4 Values in Non-Contiguous Cells of a Row

SUM Largest 4 Values in Non-Contiguous Cells of a Row SUM Largest 4 Values in Non-Contiguous Cells of a Row Cell B9 formula: Non-Contiguous cells with even intervals – SUM largest 4 values in the 2nd row cells of B2, F2, J2, N2, R2 & V2 (consider 1st cell, skip the next 3 cells). Returns...

## Average of Last 20 Positive values only in a Column

Average of Last 20 column values, only Positives / Negatives Average of last 20 positive values (zero and above) in column A Cell G4 formula: Average of last 20 positive values (zero and above) in column A. ———————————————————————————————– Cell G4 formula: Average of last 20 positive values (zero and above) in...

## Count Unique values in a Column, with Conditions

Count Unique values in a Column, with Condition(s) Count Unique values in a Column, with Condition(s) – each distinct value is counted only once irrespective whether it appears once or multiple times Column A contains values (text or numbers) which occur either only once or multiple times (Duplicate). Columns B and C...

## Countif Array Criteria, Multiple Columns, AND / OR conditions

COUNTIF with Array Criteria, Multiple Columns, AND / OR conditions Related Links: 1. Excel VLOOKP Function, with examples. 2. Left Lookup with VLookup Excel function. 3. Left Lookup, with Index, Match & Offset Excel functions. 4. Vlookup Multiple Values – Return MULTIPLE corresponding values for ONE Lookup Value. COUNTIF (or Sumproduct) for Multiple Columns, Array Criteria, using...

## SUM Smallest 3 Values in Non-Contiguous Cells with Uneven Intervals

SUM Smallest 3 Values in Non-Contiguous Cells with Uneven Intervals SUM of Smallest 3 Non Contiguous Cells (with values above zero or non-blank cells) with Uneven Intervals SUM Smallest 3 of 7 Non Contiguous Cells (A2, A4,A5, A7,A8, A11, A12) – Multiple Methodologies are illustrated Cell D17 and D27 formulas: Both formulas – Sum...

## Average Largest 5 column values, per Matching Id

Average of Largest 5 Values in a Column, per Matching Id Average of Largest 5 Values in column B, corresponding to the respective Id in column A. Cell F2 formula: Average of Largest 5 Values in column B, corresponding to the respective Id in column A – Blank cells are ignored, and zeros are considered for Average. ...

## Count Uniques Appearing in Only One or in Both Columns

Count Uniques appearing in BOTH Columns or in 1 Column and NOT in Other Count Uniques: (i) which appear in BOTH Columns; (ii) which appear in 1 Column and NOT in the Other Column Each Student (column A) has Multiple Subjects in Semester 1 (column B) and in Semester 2 (Column C)....

## Count Occurrences of a Value in Column, as a whole or in part

Count Occurrences of a Value in all cells of a Column, either individually or part of a string Related Links: 1. Excel VLOOKP Function, with examples. 2. Left Lookup with VLookup Excel function. 3. Left Lookup, with Index, Match & Offset Excel functions. 4. Vlookup Multiple Values – Return MULTIPLE corresponding values for ONE Lookup Value. Count...

## Sum Diagonal Cells in a Range

SUM Diagonal Cells in a Range SUM / Count Diagonal Cells in a Range Diagonal cells are considered starting from the top-left cell of the range Cell G4 formula: SUM diagonal cells in range “B4:E9” starting from cell “B4” ie. top-left cell of the range – cells B4, C5, D6, E7. ———————————————————————————————– ...

## Average of Consecutive Negative Numbers

Average of Consecutive Negative Numbers in a Column Average of Consecutive Negative Numbers in column A. Cell C3 formula: Average of Consecutive Negative Numbers (ie. if Consecutive more than Once atleast) in Column A. ———————————————————————————————– Average Consecutive Negative Numbers Cell C3 formula: Average of Consecutive Negative Numbers (ie. if Consecutive more than Once atleast) in...

## Vlookup Multiple Values – Return MULTIPLE corresponding values for ONE Lookup Value

Vlookup Multiple Values – Return MULTIPLE corresponding values for ONE Lookup Value Related Links: 1. Excel VLOOKP Function, with examples. 2. Left Lookup with VLookup Excel function. 3. Left Lookup, with Index, Match & Offset Excel functions. 4. Case Sensitive Vlookup; Finding the 1st, 2nd, nth or last occurrence of the Lookup Value. Return MULTIPLE...

## Excel Text and String Functions: TRIM & CLEAN

Excel Text and String Functions: Removing spaces and nonprinting characters from text: Excel TRIM & CLEAN functions Related Links: 1. ASCII Code, Extended ASCII characters (8-bit system) and ANSI Code. 2. Excel CODE & CHAR functions. 3. Excel Text and String Functions: LEFT, RIGHT, MID, LEN, FIND, SEARCH, REPLACE, SUBSTITUTE. When you import data into...

## Run VBA Macros on Protected Worksheet; Unprotect & Protect, UserInterfaceOnly argument; Worksheet.Protect Method

Run VBA Macros on Protected Worksheet ——————————————————————————————- Contents: Unprotect & Protect Error Handler UserInterfaceOnly Run macro on protected worksheet, code remaining visible & editable, but protection password hidden Using the UserInterfaceOnly argument to Enable Auto Filter Using UserInterfaceOnly argument to Allow Grouping Worksheet.Protect Method ——————————————————————————————- If you run macros on a protected...

## ASCII Code, Extended ASCII characters (8-bit system) and ANSI Code.

ASCII Code, Extended ASCII characters (8-bit system) and ANSI Code Related Links: 1. VBA Chr & Asc functions explained; corresponding Excel CHAR and CODE functions. 2. Excel Text and String Functions: TRIM & CLEAN. A ‘character set‘ maps characters to their identifying code values. Unicode is a global standard for character encoding and is the...

## Excel CODE & CHAR Functions, VBA Asc & Chr Functions

Excel Text and String Functions: Excel CODE & CHAR Functions, VBA Asc & Chr Functions, with examples. Related Links: 1. Using VBA Chr and Asc functions to convert excel column number to corresponding column letter, and column letter to column number. 2. ASCII Code, Extended ASCII characters (8-bit system) and ANSI Code. 3. Excel Text...

## Find Method in Excel VBA, Find Multiple Occurrences, Find Method to do Vlookup, Find Method to Search Date

Find Method in Excel VBA, Find Multiple Occurrences, Use Find Method to do Vlookup, Find Method to Search Date ———————————————————————— Contents: Find Method in Excel VBA Find multiple occurrences of an item or value in a range Using Find Method to do VLookUp Using Excel Find Method to Search for a Date ———————————————————————— Find Method...

## Worksheet Selection Change Event, Excel VBA

Worksheet Selection Change Event in Excel VBA and Preventing Event Loops Related Links: Excel VBA Events, Event Handler, Trigger a VBA Macro. Worksheet Change Event in VBA and Preventing Event Loops. ———————————————————————— Contents: Worksheet_SelectionChange Event Preventing Event Loops with Application.EnableEvents = False ———————————————————————— Worksheet_SelectionChange Event: You can auto...

## Worksheet Change Event, Excel VBA

Worksheet Change Event in VBA and Preventing Event Loops Related Links: Excel VBA Events, Event Handlers, Trigger a VBA Macro. Worksheet Selection Change Event, Excel VBA. ———————————————————————— Contents: Worksheet_Change Event Preventing Event Loops with Application.EnableEvents = False ———————————————————————— Worksheet_Change Event: You can auto run a VBA code, when...

## Excel VBA Events, Event Procedures (Handlers), Triggering a VBA Macro

Excel VBA Events, Event Procedures (Handlers), Triggering a VBA Macro Related Links: Worksheet event – Change Event – is illustrated in chapter: Worksheet Change Event in VBA and Preventing Event Loops; Worksheet event – Selection Change Event – is illustrated in chapter: Worksheet Selection Change Event, Excel VBA; Event Procedures of ActiveX...

## Excel Date and Time Functions and Formulas

Excel Date and Time Functions & Formulas Excel Dates Equate to Serial Numbers: Excel stores all dates as integers and all times as decimal fractions. With this system, Excel can add, subtract, or compare dates and times just like any other numbers, and all dates are manipulated by using this system....

## CHOOSE Function in Excel

CHOOSE Function in Excel and its uses, make Vlookup Look Left & Find Date of Next Monday with CHOOSE function. Related Links: VLOOKUP formula that looks left instead of right. ————————————————————————————————————————– Excel CHOOSE Function The CHOOSE function returns a value from a list of values based on a specified position number. Syntax: CHOOSE(position_number,...

## Find Smallest and Largest Value in a Range with VBA

Finding Smallest and Largest Value with VBA. Using ParamArray to find Minimum Value. Related Links: Remove Duplicates in a range, using “Find ‘Smallest’, ‘Largest’, ‘K-th Smallest’ and ‘K-th Largest’ Numbers in a Range, with Excel Functions. ———————————————————————————————– Contents: Determine smallest value in range Determine largest value in range Determine smallest value in each non-blank row...

## Find ‘Smallest’, ‘Largest’, ‘K-th Smallest’ and ‘K-th Largest’ Numbers in a Range

Find ‘Smallest’, ‘Largest’, ‘K-th Smallest’ and ‘K-th Largest’ Numbers in a Range with Excel Functions Related Links: Remove Duplicates in a range, using “Find Smallest and Largest Value with VBA. Using ParamArray to find Minimum Value. ————————————————————————————————————————— Find Smallest Number or K-th Smallest Number in a Range Find Smallest Number in a Range,...

## Application.OnTime VBA, Schedule Excel to Run Macros at Periodic Intervals or a Specified Time

Scheduling Excel to Run a Procedure at periodic intervals or at a specific time of day, with the OnTime Method. Automatically run macros. Excel Application.OnTime Method – Scheduling OnTime Events Use the Application.OnTime Method to run a procedure at specified intervals or at a specific time of day. Syntax: ApplicationObject .OnTime(EarliestTime,...

## Excel IF Function and IF Statements

Excel IF Function and IF Statements, with Examples Related Link: If…Then…Else Statements (VBA). ———————————————————————————————————————— Excel IF Function: The IF function is used to test if a condition is True or False. If a specified condition evaluates to TRUE, the IF function returns one value, and if the condition evaluates to...

## Excel VLOOKUP Function

VLOOKP Function in Excel (with examples), using Exact and Approximate Matches, Error (#N/A) handling, … Related Links: 1. Left Lookup with VLookup Excel function. 2. Left Lookup, with Index, Match & Offset Excel Functions. 3. Vlookup Multiple Values – Return MULTIPLE corresponding values for ONE Lookup Value. 4. Case Sensitive Vlookup; Finding...

## Excel OFFSET Function

Using the Excel OFFSET Function, with Examples —————————————————————————————————————————— OFFSET Function: The excel OFFSET function returns a range, which is offset by a specified number of rows and columns from a reference range. Syntax: OFFSET(reference_range, rows, columns, height, width) 1. reference_range is a single cell or a range of adjacent cells...

## Remove Duplicates in a range, using “Remove duplicates” button in Data Tools

Related Links: Count Number of Unique Values, with Excel Functions Remove Duplicates or Create a List of Unique Records Using Advanced Data Filter Remove Duplicates or Create a List of Unique Records using Excel Formula ————————————————————————————————————————— Remove Duplicates in a range, using “Remove duplicates” button in the top menu tab Data -> Data...

## Remove Duplicates or Create a List of Unique Records using Excel Formula

Related Links: Count Number of Unique Values, with Excel Functions Remove Duplicates or Create a List of Unique Records Using Advanced Data Filter Remove Duplicates in a range, using “Remove duplicates” button in Data Tools ————————————————————————————————————————– Remove Duplicates or Create a List of Unique Records in Excel Create a List of...

## Remove Duplicates or Create a List of Unique Records using Advanced Data Filter

Related Links: Count Number of Unique Values, with Excel Functions Remove Duplicates or Create a List of Unique Records using Excel Formula Remove Duplicates in a range, using “Remove duplicates” button in Data Tools Create a List of Unique Records Using Advanced Data Filter: ——————————————————————————————————– Using Advanced Data Filter Select a...

## Count Number of Unique Values in a Range (with Excel Functions)

Related Links: Remove Duplicates or Create a List of Unique Records Using Advanced Data Filter Remove Duplicates or Create a List of Unique Records using Excel Formula Remove Duplicates in a range, using “Remove duplicates” button in Data Tools ————————————————————————————————————————— Count Number of Unique Values (when No Blank Cells), with Excel Functions: ...

## Excel INDIRECT Function

Excel INDIRECT Function, with Examples: —————————————————————————————————————————– Excel INDIRECT Function: The INDIRECT function returns the result of a specified reference. Syntax: INDIRECT(text_reference, reference_type) 1. text_reference is a reference to a cell and that cell can contain: (i) an A1-style reference; (ii) an R1C1-style reference; (iii) a named range; or (iv) a...

## Convert Text and Cells with Formulas to UpperCase with VBA

Convert to Uppercase – Excel VBA Codes: To insert vba code for worksheet event procedures, right click on the Worksheet name tab, select View Code and paste the code into the Code Window that appears at right. Convert Text and Cells with Formulas to UpperCase – worksheet event procedure Private Sub...

## Change Font Color in Cells with VBA

VBA Code for customized Font Color in Cells Code for different font color in cells having “formulas”, “formulas and numbers” and “constants”. Sub FontColorFormulas1() ‘Worksheet Code for different font color in cells having formulas, formulas and numbers and constants. Run this code to change font colors in Used Range in Active Sheet.Dim...

## VBA codes to determine Last Used Row & Last Used Column in Excel

VBA Codes – Find last used row in a worksheet or in a specific column; Find last used column in a worksheet or in a specific row. Related Links: Find last used row number & cell address with excel functions. ———————————————————————————————————– Contents: Use End(xlUp) to determine Last Row with Data, in one...

## Shade Alternate Rows – Conditional Formatting

Shade Alternate Rows using Conditional Formatting —————————————————————————————————————————- Shade Alternate Rows, including blank/unused range Select worksheet range you wish to format Home -> Conditional Formatting -> New Rule -> select “Use a formula to determine which cells to format” option (Excel 2007) Format -> Conditional Formatting -> “Formula Is” (earlier...

## Excel SUMPRODUCT Function

Using SUMPRODUCT FUNCTION Using double unary minus (–) n SUMPRODUCT Function -> A significant use ———————————————————————————————————————————————————— Excel SUMPRODUCT Function: The SUMPRODUCT function multiplies corresponding items of two or more arrays and then sums up these products. Syntax: SUMPRODUCT(array1, array2, … array255) 1. array1, array2, … array255 are arrays whose...

## Left Lookup with Vlookup Excel Function

VLOOKUP formula that looks Left instead of Right Related Links: 1. Excel VLOOKP Function, with examples. 2. Left Lookup, with Index, Match & Offset Excel functions 3. Vlookup Multiple Values – Return MULTIPLE corresponding values for ONE Lookup Value. 4. Case Sensitive Vlookup; Finding the 1st, 2nd, nth or last occurrence of the...

## Left Lookup with Index, Match and Offset Excel Functions

Left Lookup with Index, Match and Offset Excel Functions Related Links: 1. Excel VLOOKP Function, with examples. 2. Left Lookup with VLookup Excel function 3. Vlookup Multiple Values – Return MULTIPLE corresponding values for ONE Lookup Value. 4. Case Sensitive Vlookup; Finding the 1st, 2nd, nth or last occurrence of the Lookup Value....

## Last used row number and cell address, last numeric or text value in column

Find Last Used Row in a Column: Related Links: VBA Codes – Last used row; Last used column. ——————————————————————————————————— Formula for ‘Cell Address of the last numeric value within column’ =ADDRESS(MATCH(9.99999999999999E+307, A:A), COLUMN(A1)) [Formula] The formula returns cell address of the last numeric value in column, which is...