Is there a function in Excel that is similar to the Ruby Split Method?

Given the following line:

"Data 1998 1999 2000 2001 2002 2003 2004 2005 2006"

I would like to be able to take a row and put the data in 10 separate columns in an Excel spreadsheet. I am working on a custom function, but it is not working yet.

Has anyone already decided this?

thank

+3
source share
2 answers
  • Select your range in which there is a line that you want to split.
  • Go to the data tab
  • Select text in columns
  • Set the separator in the field

You can also do this using the formula: http://www.excelforum.com/excel-general/591897-text-to-columns-but-using-a-formula.html

Or use creamyegg code.

+5
source

- . VBA Split(), , . A1:I1 :

Dim varArray As Variant

varArray = Split("Data 1998 1999 2000 2001 2002 2003 2004 2005 2006", " ")

ActiveSheet.Range(Cells(1, 1), Cells(1, UBound(varArray))).Value = varArray
+3

All Articles