I have two sheets of data as per below:

║ SheetName ║ Cell ║  CellValue   ║
║ Sheet1    ║ B1   ║ ='sheet2'!A2 ║
║ Sheet2    ║ A2   ║ 0576543 ABC  ║

This produces the output 0576543 ABC in B1

I want the value in B1 to replace the text after the space with xxx.

The value in B1 should be 0576543 xxx.

I have tried this Regex but it produces an error.

=REGEXREPLACE("'sheet2'!A2", " .*", "xxx")

Where am I going wrong?

  • I have edited your question to make it clearer. – codingbadger Sep 18 '15 at 10:05

The issue in this case appears to be that you put double quotes and single quotes around the cell reference, try this, should fix it.

=REGEXREPLACE(sheet2!A2, " .*", "xxx")

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.