细胞内数字分裂细胞 [英] Split Cell by Numbers Within Cell

查看:143
本文介绍了细胞内数字分裂细胞的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些字段需要分割成不同的单元格。它们具有以下格式:


使命21上的数字0 21



任务5中的数字1 6


所需的输出将是4个单独的单元格。第一个将包含字符串使命中的数字中的单词,后续单元格将具有由空格确定的每个数字。所以对于第一个例子,要提取的数字将是21,0和21.每个都将在它自己的单元格中的字符串值旁边。而对于第二个:5,1,6。



我尝试使用拆分功能,但不知道如何专门定位数字,并确定数字在分隔它们的空格上。

解决方案

我能够使用以下内容正确分割值:

 如果i.Value Like* on Mission *然后

x = Split(i,)

对于y = 0到UBound(x)

i.Offset(0,y + 1).Value = x(y)

下一个y

结束如果


I have some fields that need to be split up into different cells. They are in the following format:

Numbers on Mission 21 0 21

Numbers on Mission 5 1 6

The desired output would be 4 separate cells. The first would contain the words in the string "Numbers on Mission" and the subsequent cells would have each number, which is determined by a space. So for the first example the numbers to extract would be 21, 0, 21. Each would be in its own cell next to the string value. And for the second: 5, 1, 6.

I tried using a split function but wasn't sure how to target the numbers specifically, and to identify the numbers based on the spaces separating them.

解决方案

I was able to properly split the values using the following:

 If i.Value Like "*on Mission*" Then

x = Split(i, " ")

    For y = 0 To UBound(x)

    i.Offset(0, y + 1).Value = x(y)

    Next y

End If

这篇关于细胞内数字分裂细胞的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆