troubleshooting Question

Vba function to make range based on criteria

Avatar of Raahaugen
RaahaugenFlag for Denmark asked on
Microsoft Excel
3 Comments1 Solution409 ViewsLast Modified:
Hey Experts!

Scenario: I have one table with lots of records. In one row I have Initials, and in another row I have Department. The order is random.

Problem: In other places in the workbook I want to use individual ranges with all the initials in a given department, etc. using the index() excel function.

Trying to write the function in semi VBA and semi plain english:

public function range.if(rng as range, criRng as range, cri as string)
      for each c in rng
            if c in criRng = cri then include c in output
      exit for
      range.if = output
end function

Regards Raahaugen
Cost Accountant
Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros