I am using the Query function within a Google Sheet to pull data. I need to add criteria to only pull data based on the Mode of a specific column. The mode changes with the data so using the Mode function to make it dynamic would make life easier. This works when I hard code in the Mode value. I've tried several different variations but have not been able to get the Mode function to work when nested within my Query formula.
Here is my current formula.
=QUERY('2 - Add Raw AZ Payments Report'!A8:AA4005,"select C WHERE ((C = 'Refund') AND AA <> 0 AND B = 13742433281) OR C = 'Order' OR C = 'Adjustment' OR C = 'Chargeback Refund'",0)
13742433281 is the hardcoded Mode. Ideally, I would replace that value with the Mode function if it can be used with a Google Sheets Query.
Here is a link to a Google Sheet with the Query I am using now and the desired query with the Mode hardcoded. Essentially I would like to replace the hardcoded Mode Value with the Mode formula.
https://docs.google.com/spreadsheets/d/126IfGStccfzKLGW7dH-7TpbMbPSZXW3Of69RZ61jb8Q
Any help would be very much appreciated.
- John