I know this works:
= hyperlink( "https://www.google.com/search?q=" & B2 )
But I can't get two variables to work so the link would look like:
https://www.google.com?var1=[insert cell contents]&var2=[insert cell contents]
This works for me.
As I understand your question
should suit. However, since the example you give is for a Google search and Google ignores punctuation in search terms (probably for the best!) (see and tag wiki for [google-search]) there may be no need for two variables. Ie string terms together within B2 thus:
So with that and