14

I have regressions tables in an Excel spreadsheet where the significativity is indicated with stars (*) characters. Those are attached to the number in the cell and the number of stars is not constant: sometimes three, sometimes two, sometimes one and sometimes none.

I would like to remove those asterisks such that I can use the number in the cell (it is currently understood as text by Excel because of the presence of the asterisk.)

I tried the following:

  • search and replace the character * , but since Excel understands it as "everything", I end up with an unwanted result. I also tried variants of it: "",''.

  • Text to columns: but since the number of asterisks is not constant, it could not work. Besides, I would have to manually do it for an impressive number of columns so this solution is not practicable.

  • Manually removing the stars is out of the question, too.

As an example, here is what I want to do:

A1=1***

A2=2*

A3=3

A4=sum(A1:A3)

0

3 Answers 3

61

The escape character in Excel is the ~. So, to find and replace all asterisks, search for ~* and replace with nothing. Please see the image in order to remove all * characters.

screenshot

2
  • 1
    Just a side comment for other readers: I always forget the quoting character - but found that it is also explained in the Help text of the Search&Replace dialog. so the quickest way to find it next time you're not sure is F1! :-) Dec 17, 2013 at 13:48
  • Note that this also works for ~? Feb 9, 2022 at 14:35
4

Use ~* for the string to search.

If using Text to columns, there is a check box for Treat consecutive delimiters as one, and that is a perfect alternative for what you need.

2
  • Yes it works, but I have 20 columns to process. Hence, I'll for the trunc(substitute) version.
    – user89073
    Dec 17, 2013 at 10:50
  • @user89073 - Text to columns should work for any number of columns, I guess. At any rate, you already have a solution. Dec 17, 2013 at 13:52
2

I managed using this formula

B1 = TRUNC(SUBSTITUTE(A1; "*"; ""); 0)
B2 = TRUNC(SUBSTITUTE(A2; "*"; ""); 0)
B3 = TRUNC(SUBSTITUTE(A3; "*"; ""); 0)
B4 = SUM(B1:B3)
2
  • 1
    You could do all that within a single formula e.g. leave A1:A3 as they are and use this formula for the sum =SUMPRODUCT(SUBSTITUTE(0&A1:A3;"*";"")+0) Dec 17, 2013 at 10:50
  • Sorry again, your method works only for text, right ? I want to generalize it to cells where numbers are stored as numbers.
    – user89073
    Dec 17, 2013 at 10:55

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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