Search code examples
google-sheetsgoogle-sheets-formula

How to get each customer sales and list them in one page sort by date


I have pages for my each customer like these; Main,Customer1,Customer2,Customer3

Each customer page contains these table;

Customer1 | DATE | Product | Total| | -------- | -------------- | -------------- | | 5.07.2023 | apple | 20 | | 10.08.2023 | banana | 30 |

On the main page, I am trying to list all customer sales in August with the date order

THANKS!

I tried INDIRECT formula but it doesnt work.


Solution

  • Recommendation:

    Try using QUERY instead of INDIRECT. Let me know if this works for you:

    =QUERY({ Customer1!A:D; Customer2!A:D; Customer3!A:D }, "select * WHERE Col1 >= date '" & TEXT(DATEVALUE("01/08/2023"), "yyyy-dd-mm") & "'and Col1 < date '" & TEXT(DATEVALUE("01/09/2023"), "yyyy-dd-mm") & "'")
    

    You can add multiple sheets inside {}, separated by ;. This formula assumes that the date is always on the first column of the sheet. Feel free to change the column as needed

    Reference: