Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Append & prepend string to existing rows

I have a table of numbers:

1
2
3
4
5
6
7
.
.
.

What i would like to get:

*1*
*2*
*3*
*4*
*5*
*6*
*7*
.
.
.

I have written a formula, but i dont know how to apply this function to the existing table. I keep getting some kind of reference error. (REF!)

My formula:

= "*" & A2:A(whatever number is last) & "*"
like image 729
Biker John Avatar asked Apr 24 '14 13:04

Biker John


2 Answers

Assuming this is a one time thing...

  1. Insert a column next to the one you want to change
  2. write the formula as ="*"&B1&"*" where b1 is the 1st cell containing the number to add * to.
  3. go to the end of the column with the numbers, arrow over to the next cell (empty column with the formula.)
  4. press ctrl shift up arrow highlighting all the cells in that column from the last number to top.
  5. press ctrl d to fill down
  6. now highlight the column with the correct values (#) and select copy.
  7. right click on the original column letter.
  8. select paste special
  9. select values click ok
  10. delete the column you originally added.
like image 101
xQbert Avatar answered Oct 25 '22 01:10

xQbert


You can do this with a basic auto-filled function. Are you familiar with auto-fill in excel?

Here is an example:

=IF(A2<>".","*"&A2&"*",A2)

1

like image 38
Stepan1010 Avatar answered Oct 25 '22 01:10

Stepan1010