title: Combine REGEXREPLACE and CONCAT into the same formula in Google Sheets
body: <p>I have two formulas I need to combine into one. But I am getting a calculation error: "<strong><em>Wrong number of arguments to IF. Expected between 2 and 3 arguments, but received 4 arguments.</em></strong>"</p>
  
  <p>Here is the first formula</p>
  
  <pre><code>=REGEXREPLACE(A4, "(/[^/]+)(?:/\?[^/]*)?$", "$1/")
  </code></pre>
  
  <p>Here is the second formula</p>
  
  <pre><code>=ARRAYFORMULA(IF(ISBLANK(B2:B),"",(CONCAT(B2:B,"?tag=ukos-20"))))
  </code></pre>
  
  <p>Here is my attempt</p>
  
  <pre><code>=ARRAYFORMULA(IF(ISBLANK(B2:B),"",(REGEXREPLACE(B2:B, "(/[^/]+)(?:/\?[^/]*)?$", "$1/")),(CONCAT(B2:B,"?tag=ukos-20"))))
  </code></pre>
  
  <p>The following is <a href="https://docs.google.com/spreadsheets/d/1FRCCS3fhPx7oUjsl3AeV5Nui7GrT4wi4ElluzFjhqB0/edit?usp=sharing" rel="nofollow noreferrer">an example in a Google Sheet</a>, which can be copied if required with <strong><em><code>File-&gt; Make a Copy</code></em></strong>.</p>
  
  <p>So we are performing regex on the rows and then passing that result into concat which appends a tag to the URL.</p>