Extracting string separately from Excel

2019-08-08 07:34发布

I have rows in Excel in which there is

[test].[test1]

How can I extract test and test1 separately ?

标签: excel
3条回答
Ridiculous、
2楼-- · 2019-08-08 08:06

The easiest way is to use text to columns (as mentioned by pnuts) but here's a couple of other options to explore:


VBA:

 x = Split(Range("A1"), ".")
  Debug.Print x(0) '// Prints "test"
  Debug.Print x(1) '// Prints "test1"

Formula:
=LEFT(A1,SEARCH(".",A1)-1) Will return "test"
=MID(A1,SEARCH(".",A1)+1,LEN(A1)) Will return "test1"


查看更多
SAY GOODBYE
3楼-- · 2019-08-08 08:14

Select the range of cells in a column on which you want to perform the split action. Click 'Data'. From 'Data Tools', Click 'Convert Text to Table'. Click 'Next'. Select the appropriate delimiter check box. Click 'Next'. From 'Column data format', select appropriate option. Click 'Finish'.

查看更多
家丑人穷心不美
4楼-- · 2019-08-08 08:27

Assuming the the string is in A1, then paste this formula to B1:

=TRIM(MID(REPT(" ", 999)&SUBSTITUTE(SUBSTITUTE($A1, "[", REPT(" ", 999)), "]", REPT(" ", 999)), COLUMN(A:A)*1999, 999))

You can copy the formula in B1 to C1, D1, E1,... to get 2nd, 3rd,... word.

enter image description here

查看更多
登录 后发表回答