excel vba select range between two numbers

Issue

Select range between two numbers

  1. C column is sorted from the input data
  2. From the sorted output, the selected range should be with in -0.25 to +0.25

How to add more than one criteria in COUNTIF function or its similar function?

Original syntax:

.Resize(Application.CountIf(.Cells, "<0")).Select

Requirement:

.Resize(Application.CountIf(.Cells, ">-0.25 & <0.25")).Select

Solution

Replace CountIf with CountIfs when you want more than one condition. Try this:

.Resize(Application.WorksheetFunction.CountIfs(.Cells, ">-0.25", .Cells, "<0.25")).Select

Answered By – Sam

Answer Checked By – Marie Seifert (AngularFixing Admin)

Leave a Reply

Your email address will not be published.