Google-sheets – How to combine same value for Google sheet query

google sheetsgoogle-sheets-query

I am trying to create a separate tab in my Google sheet where I can filter the Trainer to see which days they will be conducting a Day 1 and Day 2 Training.

Day 1 Training:

=iferror(
     query('Hiring Tracker'!N:Q,
     "Select N Where O = '"&A2&"' and N >= date '"&G2&"' order by N asc"
     ,0
     )
)

Day 2 Training:

=iferror(
    query('Hiring Tracker'!N:Q,
    "Select P Where Q = '"&A2&"' and P >= date '"&G2&"' order by P asc"
    ,0
    )
)

But instead of showing multiple same dates, is there a way I can combine the same values to show which days the Trainer will be training. The chart on the right is what I want to have and the chart on the left is what I have right now.

enter image description here

Training Doc

Best Answer

Use the formula =unique

Day 1 Training:

=UNIQUE(iferror(
             query('Hiring Tracker'!N:Q,
             "Select N Where O = '"&A2&"' and N >= date '"&G2&"' order by N asc"
             ,0
             )
))

Day 2 Training:

=UNIQUE(iferror(
            query('Hiring Tracker'!N:Q,
            "Select P Where Q = '"&A2&"' and P >= date '"&G2&"' order by P asc"
            ,0
            )
))