I have a huge list of numbers such as 123456 that I have to change into: ,'123456'. How can I do this in word or excel?
Thanks
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.
Sign up to join this communityI have a huge list of numbers such as 123456 that I have to change into: ,'123456'. How can I do this in word or excel?
Thanks
Ctrl+h does the trick. Is built in in excel and word.
In Excel you can e.g. mark only one column or one row and do then your replacement with Ctrl+h . That way you keep other columns/ rows untouched.
Let's assume that you have a long column of these numbers in column A of an Excel worksheet, starting with cell A1.
In cell B1, enter =",'"&A1&"'"
Then autofill down: select cell B1, hover over the square that appears at the bottom-right corner of the cell, and double-click. (If you have any gaps in the column of numbers, you may need to drag down on the square instead.)
Now right-click on the column heading and choose Copy
, then right-click again and choose Paste Values
.
just use the find and replace function that is built into excel.
With data like:
Select the cells you wish to change and run this short VBA macro:
Sub FixData()
Dim r As Range
For Each r In Selection
r.Value = ",'" & r.Value & "'"
Next r
End Sub
Which will produce:
Each cell gets a prefix of comma quote and a suffix of quote.
123 / 2345 / 2918 / ...
. In the end, are you trying to put all these in a single list,'123', '2345', '2918', ...
? – BruceWayne Feb 28 at 15:20