A family of Microsoft relational database management systems designed for ease of use.
You say you want to 'sort data based upon two parameters', but parameters are normally used to restrict the result table of a query, not sort (order) it. If we take data from Northwind as an example, the following would be a sort:
SELECT [First Name], [Last Name] , [State/Province], City
FROM Customers
ORDER BY [State/Province], City;
and would return a result table like this:
First Name Last Name State/Province City
Thomas Axen CA Los Angelas
Alexander Eggerer CA Los Angelas
Daniel Goldschmidt CA San Francisco
Carlos Grilo CO Denver
Soo Jung Lee CO Denver
Peter Krschne FL Miami
Run Liu FL Miami
and so on
The following would be restriction on State/Province and City:
SELECT [First Name], [Last Name] , [State/Province], City
FROM Customers
WHERE [State/Province] = "CA"
AND City ="Los Angelas";
and would return the following two row result table:
First Name Last Name State/Province City
Thomas Axen CA Los Angelas
Alexander Eggerer CA Los Angelas
A sort and restriction can of course be combined in a single query.
The parameters in the second example above are literal strings within the query, but in reality they'd be variable values passed into the query at runtime. In either case the result table of the query could be exported to Excel.
So which is it you want, a sort or a restriction? Whichever is the case it is difficult to see why anyone would do this by means of a Select Case construct in a VBA function. Perhaps if you posted the full code of the function we'd be able to see what the original writer of it intended.