MeisterZeta
MeisterZeta

Reputation: 13

Query should exclude headers

I'm trying to get just one result from this query:

=QUERY('Registro Clinico'!A1:AA1000; "select A where(B='B12')")

where B12 contains 17.555.829-2.

I need it to return the ID of the patients, but it's returning the header name "ID".

Upvotes: 1

Views: 141

Answers (2)

Mogsdad
Mogsdad

Reputation: 45740

You can exclude headers by supplying FALSE for the headers parameter. (Documentation)

=QUERY('Registro Clinico'!A1:AA1000; "select A where (E='"&B12&"')"; FALSE)
                                                                     ^^^^^

You had other problems as well:

  • The Query language does not support references into the spreadsheet in the way you had tried to write it.

    "...where (B='B12')..."
    

    Instead, you need to concatenate text segments using the & operator:

    "...where (B='" & B12 & "')..."
                  ^^^     ^^^
    
  • The column in 'Registro Clinico' that contains 17.555.829-2 is E, not B.

Upvotes: 1

eniacAvenger
eniacAvenger

Reputation: 875

This should do the trick:

=QUERY('Registro Clinico'!A1:AA1000,"select A where E='" & 'Registro Clinico'!B12 & "'", FALSE)

Upvotes: 0

Related Questions