Board logo

标题: [电脑] 江湖救急Excel相关 [打印本页]

作者: 孙艺珍    时间: 2011-11-7 18:26     标题: 江湖救急Excel相关

比如说

有一个列
其中每格都是用;分开的几个字段
字段长短不一,字段数量也不一

我现在需要每格的最后一个字段,要如何搞?

rewdd;121312;31231231;3dsa
tdsada;53ew;iyeerh
dasi2e;412dsa;43281;213kcsad;asd

比如上面的,我用了分列之后,最后一个字段无法在一列里面啊
作者: gr_finger    时间: 2011-11-7 20:06

用分列,分隔符号就是; 然后把其它无关列删除就行了
作者: ofanjx    时间: 2011-11-7 20:27

用两个函数吧,先获取每一行的字段数,然后抓取
作者: johentai    时间: 2011-11-7 20:48

posted by wap, platform: SAMSUNG (Nexus S)

导入。。。分隔符;
作者: jammin    时间: 2011-11-7 20:55

导入分隔符之后,在前面插一列,例如插入A列是空白的,从B列开始到后面都是导入后的数据
然后又在A列(例如A1)写公式:
=OFFSET($A1,0,COUNTA($A1IV1)-1)

详见附件
作者: jammin    时间: 2011-11-7 20:56

引用:
原帖由 ofanjx 于 2011-11-7 20:27 发表
用两个函数吧,先获取每一行的字段数,然后抓取
这个是可以直接用的函数,但是江湖救急的话就有点太overkill了

'------------------------- UDF that helps to extract nth string out of
'If "n" is missing, the output will be the number of values in the CSV string
'Delimiter symbol is default to ","
'20091215, Changing the parameter to be able to nesting the UDF
'Public Function CSV(ByRef rRange As Range, Optional ByVal n As Variant, Optional ByVal strDelimiter As Variant) As Variant
Public Function DSV(ByVal rRange As Variant, Optional ByVal N As Variant, Optional ByVal strDelimiter As Variant) As Variant
    'Using "," as default de-limitator
    If IsMissing(strDelimiter) Then strDelimiter = ","
   
    Dim x As Variant
    Dim vResult As Variant
   
    'Cast the input to string type before proceeding
    x = Split(rRange, strDelimiter)
   
    On Error Resume Next
    If IsMissing(N) Then
        vResult = UBound(x) + 1
    Else
        vResult = x(N - 1) 'Because split() returns an array whose index staring from 0
        If Err <> 0 Then vResult = "Error"
        'If Err <> 0 Then vResult = rRange.Cells(1, 1)
        On Error GoTo 0
        
    End If
    DSV = vResult
End Function
作者: 小文和小武    时间: 2011-11-8 14:35

技术贴!留住
作者: 186000    时间: 2011-11-8 16:13

进来学习...
作者: hudihutian    时间: 2011-11-8 16:44

你们在搞笑吧

选那一列,查找替换,把*;替换为什么都没有即可

excel 2010按lz的例子通过
作者: 孙艺珍    时间: 2011-11-8 16:46

我自己想了半天
后来手动解决了
直接筛选blank
让blank=前一格

然后最后一列就是我需要的了。。
作者: 双面胶    时间: 2011-11-8 17:22

posted by wap, platform: HTC (Hero)
引用:
原帖由 @hudihutian  于 2011-11-8 16:44 发表
你们在搞笑吧

选那一列,查找替换,把*;替换为什么都没有即可

excel 2010按lz的例子通过
正解啊,学习了
作者: jammin    时间: 2011-11-8 19:18

posted by wap, platform: Nokia (6120)
引用:
原帖由 @hudihutian  于 2011-11-8 16:44 发表
你们在搞笑吧

选那一列,查找替换,把*;替换为什么都没有即可

excel 2010按lz的例子通过
好方法啊,学习啦




欢迎光临 TGFC Lifestyle (http://bbs.tgfcer.com/) Powered by Discuz! 6.0.0