Search code examples
google-sheetsregexp-replace

Combine 2 REGEXREPLACE Formulas Into One


In cell C5, I have a date with dashes ---> 01-31-2013

I just need to remove the dashes, extract only the first 4 digits in the date (in this case, 0131), and append 'Efisd' at the BEGINNING of the string.

So, the end result should look like this ---> Efisd0131


So far, I've been able to remove the dashes, and extract the first 4 digits of the date. But, I can't seem to put append 'Efisd' to the beginning and put it all together into one formula.

Does anyone know how to do this? Thanks for your help.

Here's the sample spreadsheet that you can edit


Solution

  • From just the input date you can get it done with this:

    ="Efisd"&left(substitute(B5,"-",""),4)
    

    It substitutes the dashes for blanks, gets the left 4 characters, and ads Efisd to the front.