2

I choose type ="html" and then copy and paste the output to excel.

All work perfectly except the () in surround a value transfers the value into a negative one.

For example, (2.451) that presents the standard errors becomes -2.451

Is there a way to fix this? Thanks!

Lynn
  • 61
  • 2

1 Answers1

2

Excel interprets the parentheses around a number as an indication it should be negative. This is inconvenient for our standard errors and p-value reporting from stargazer, because (0.04) is not meant to be -0.04.

To work around this, you could:

  • Select all cells in your spreadsheet
  • Change the data type of all of the cells to "Text", so that they are not interpreted as numbers. (See screenshot below)
  • Then you can paste parenthesised numbers in, and they are treated as text (see below).

If you still need to work with some numbers as numbers, you can set those cells to "Number".

enter image description here

Jeremy K.
  • 1,710
  • 14
  • 35
  • 1
    when i paste my contents it automatically changes it back to general format so all the parenthesized numbers get changed to negative. I tried selecting everything and formatting as text, but once it's pasted it doesn't work. Any idea how to get around this? – Johnny5ish Aug 31 '20 at 01:56
  • @Johnny5ish I just tried then. This works for me: before I paste anything, I select the entire worksheet that I'm pasting into, and then turn it into "Text". Then I paste into a worksheet where every single cell has already been turned to text. Does that work for you? If not, what does the error look like? – Jeremy K. Aug 31 '20 at 04:48
  • I tried that but no it didn't work, luckily it's not too hard to select all the rows, then I change them to custom number with parentheses for negatives. – Johnny5ish Sep 13 '20 at 02:19
  • After changing the data type of all of the cells to "Text" as @JeremyK. suggested, when copying the text, we need to right click and choose "Match destination formatting" paste option to get the desirable result. – Long Vo Jul 24 '21 at 07:49