16

I have a column of hexadecimal strings:

506078
363624
505974
505644

I need excel to store these as strings, not integers or floats.

1
  • Format -> Cells -> Custom. Option '0'
    – tmarthal
    Dec 11, 2018 at 22:57

3 Answers 3

31

All you need to do for this one is put a single quote in front of your text. This also works for dates you don't want Excel picking up.

eg.

'23446

You can also format your entire column as text which will override the whole column. In Excel 2007, hilight your cells, Right click->Format Cells. Click on text from the options on the left.

1
  • 1
    can I put a single quote for entire col? I have data that is about 60000 rows, I don't want to use any formula. Apr 7, 2018 at 14:34
5

The answers already mentioned are sometimes not practical:

  • Manually prefixing each value is cumbersome and only works for current data.
  • Adding another column may not be desirable for the final receiver of the "report".

Since Excel 2013 (or even before), there is a much better way:

  • Select the full column.
  • Click DATA | Text to Columns.
  • In the dialog, click Next | click Next | choose Text | click Finish.
1
3

As answered above, formatting a number as string is not advisable because you need to activate the cell in order for the conversion to be actually executed (either by F2 or double clicking or use Find+Replace on the column, and replace a dot with a dot or any other character, but if you don't have a character persistent in each cell in your column then this workaround won't work). And once you enter a cell for some editing it will automatically return to number if the value is compatible.

Now, answering Scott's question in comments section. If you already have your data and manually adding a quote in front of your data in each cell is not an option you can use a helper column and write

="'"&A1

in B1, where A1 is the reference to your cell, and drag down across the formula in B1. At this point you will see the quote, but you can paste data in column B as values (CTRL+C & ALT+E+S and select values, or paste special as values from the top menu). Then find+replace a '(quote) with a '(quote) and you will have a column with values forced to text.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .