function to combine multiple criteria