Numbers in between
Keywords: excel,find number,between 2 numbers,search cells,number between,min,max
Description: Excel VBA. Find Number Between 2 Numbers. Search Cells for a Number Between Min & Max
Excel and most MS Office Applications, have a Find feature than can be use to find a specified value, or text string, in a range, Worksheet, or Workbook. However, no such feature exists where we can tell Excel to find the first occurrence of a number that is between a Minimum number and a maximum number. We can however use some Excel VBA macro code to do it for us.
Most would go with a loop to get a number between a nominated range. However, this can be extremely slow and horribly inefficient if the Worksheet contain thousands of used cells. The method below makes use of the SpecialCells method to ensure we are only checking numeric cells.
The code works in the same way as the standard Find feature does. That is, search ALL cells on the Worksheet if only a single cell is selected, or search ONLY the selected cells if more than one cell is selected.
If will locate and select the first cell. that has a value between (not equal to) the specified min and max. It searches by rows. Note, it will not locate a zero value.
Special. Free Choice of Complete Excel Training Course OR Excel Add-ins Collection on all purchases totaling over $64.00. ALL purchases totaling over $150.00 gets you BOTH! Purchases MUST be made via this site. Send payment proof to firstname.lastname@example.org 31 days after purchase date.