# Query function with variable in the Col1= [duplicate]

Here' the formula: `=query({{\$P\$3:\$P\$34;\$R\$3:\$R\$34;\$T\$3:\$T\$34;\$V\$3:\$V\$34;\$X\$3:\$X\$34;\$Z\$3:\$Z\$34;\$AB\$3:\$AB\$34;\$AD\$3:\$AD\$34},{\$Q\$3:\$Q\$34;\$S\$3:\$S\$34;\$U\$3:\$U\$34;\$W\$3:\$W\$34;\$Y\$3:\$Y\$34;\$AA\$3:\$AA\$34;\$AC\$3:\$AC\$34;\$AE\$3:\$AE\$34}}, "select Sum(Col2) where Col1='Adonist'",0)`

I'm on the very edge of my understanding on this formula but, at the end of the formula where it says, where Col1''Adonist'",0) where it says Adonist (Employee name) I want to put the employee name from cell P37 (Currently says Adonist). When employees come/go, I don't want to have to change the formula with the new name. When I try to replace 'Adonist' with 'P37' or '"P37"' or any other variation, it just gives me an error. The value in P37 is pulled from a list of employees on another sheet. Help?

Instead of `where Col1='Adonist'",0)` use `where Col1='"&P37&"'",0)`.
The above because the QUERY function second parameter is a TEXT value so to add a cell value as part of a condition, this cell value can be inserted by splitting the second parameter and concatenating the parts. In this case `&` used for the concatenation.