Home » excel » How do I escape a dollar sign ('$') in an Excel formula?

How do I escape a dollar sign ('$') in an Excel formula?

Posted by: admin April 23, 2020 Leave a comment

Questions:

Having a hard time checking if cells contain a dollar sign (‘$’), as Ecxel thinks I’m trying to make an absolute reference.

I’m working with imported data that includes a column of usernames, and many of the usernames have a ‘$’ character at the end. In Excel, I’m omitting some of the data in the username column, based on strings they may contain. Some example-ish accounts:

  • chi_smithcleve
  • letter_admin
  • NYCDB140$
  • outside3
  • NYCPRD148$
  • ATLDB12$
  • chi_goadjames

I want to test the usernames for three conditions: they don’t contain the string ‘NYC’, ‘chi’, or ‘$’. The character-strings are easy, but I can’t figure out how to escape the dollar-sign character! All the documentation I’ve found suggests double-quotes as an escape mechanism in Excel, but that doesn’t seem to be working. The primary formula that documentation says should work is:

=ISNUMBER(SEARCH(""$"",A2))

where I’m checking the cell A2 to see if the ‘$’ character occurs. But Excel’s just telling me that I have an error. I’ve tried several other possible escape characters, to no avail.

(I could do a ‘character replace’ function at some point upstream, to replace the ‘$’s with a more manipulatable character, but I’d rather just leave the data in same state as when it’s received)

How to&Answers:

Try this, it is working for me.

  =ISNUMBER((SEARCH("$",A2)))