copy / paste a formula with reference to another sheet?

In Google sheets, I have a formula like this:

= COUNTRY (foo! H: H, "*" & B14 & "*", foo! E: E, "*" & C14 & "*")

I want to copy as:

= PAYTIFS (bar! H: H, "*" & B14 & "*", bar! E: E, "*" & C14 & "*")

How is it accomplished?