Excel精英培训网

 找回密码
 注册
数据透视表40+个常用小技巧,让你一次学会!
查看: 3249|回复: 13

[已解决]求个好公式请各位老师指点一下

[复制链接]
发表于 2013-3-1 19:18 | 显示全部楼层 |阅读模式
求个好公式,请各位老师指点一下
最佳答案
2013-3-1 21:04
新建 Microsoft Office Excel 工作表.rar (92.03 KB, 下载次数: 18)

新建 Microsoft Office Excel 工作表.rar

38.45 KB, 下载次数: 36

发表于 2013-3-1 19:33 | 显示全部楼层
用公式挺难的,如果数据量超过1000,可能运算就慢了,所以,建议不用公式解决,用VBA
回复

使用道具 举报

发表于 2013-3-1 20:19 | 显示全部楼层
回复

使用道具 举报

发表于 2013-3-1 20:20 | 显示全部楼层
果然,用VBA是极好的。
回复

使用道具 举报

发表于 2013-3-1 20:26 | 显示全部楼层
得到的数字还是用、号相连么。
回复

使用道具 举报

发表于 2013-3-1 20:32 | 显示全部楼层
不知道这个行不行。
  1. =IF(K2="y",0,)&SUBSTITUTE(SUM(N(INDIRECT(TEXT(IF(K2:U2="y",ROW($1:$1)*100+COLUMN(K:U),4^8),"r0c00"),))*10^(11-COLUMN(A:K))),0,)&IF(U2="Y",0,)
复制代码
回复

使用道具 举报

发表于 2013-3-1 20:39 | 显示全部楼层
  1. Sub 求对应数()
  2.     Dim iLastRow As Long, i As Long, j As Long
  3.     Dim arr
  4.     Dim arrResult()
  5.     Dim strTemp As String
  6.    
  7.     iLastRow = Cells(Rows.Count, "x").End(xlUp).Row
  8.     Range("y2:y" & iLastRow).Value = ""
  9.     arr = Range("k1:u" & iLastRow).Value
  10.     ReDim arrResult(1 To UBound(arr), 1 To 1)
  11.     arrResult(1, 1) = "对应数"
  12.     For i = LBound(arr) + 1 To UBound(arr)
  13.         For j = LBound(arr, 2) To UBound(arr, 2)
  14.             If arr(i, j) Like "[yY]" Then
  15.                 strTemp = strTemp & j - 1 & "、"
  16.             End If
  17.         Next
  18.         arrResult(i, 1) = Left(strTemp, Len(strTemp) - 1)
  19.         strTemp = ""
  20.     Next
  21.     Range("y1").Resize(iLastRow) = arrResult
  22.     MsgBox "整理完毕", vbInformation + vbOKOnly
  23. End Sub
复制代码
回复

使用道具 举报

发表于 2013-3-1 20:40 | 显示全部楼层
  1. Sub 求对应数()
  2. '---------------------------------------------------------------------------------------
  3. ' Procedure : 求对应数
  4. ' Author    : hwc2ycy
  5. ' Date      : 2013/3/1
  6. ' Purpose   : 数组遍历
  7. '---------------------------------------------------------------------------------------
  8. '
  9.     Dim iLastRow As Long, i As Long, j As Long
  10.     Dim arr
  11.     Dim arrResult()
  12.     Dim strTemp As String
  13.     Application.ScreenUpdating = False
  14.     iLastRow = Cells(Rows.Count, "x").End(xlUp).Row
  15.     Range("y2:y" & iLastRow).Value = ""
  16.     arr = Range("k1:u" & iLastRow).Value
  17.     ReDim arrResult(1 To UBound(arr), 1 To 1)
  18.     arrResult(1, 1) = "对应数"
  19.     For i = LBound(arr) + 1 To UBound(arr)
  20.         For j = LBound(arr, 2) To UBound(arr, 2)
  21.             If arr(i, j) Like "[yY]" Then
  22.                 strTemp = strTemp & j - 1 & "、"
  23.             End If
  24.         Next
  25.         arrResult(i, 1) = Left(strTemp, Len(strTemp) - 1)
  26.         strTemp = ""
  27.     Next
  28.     Range("y1").Resize(iLastRow) = arrResult
  29.     Columns("y").AutoFit
  30.     Application.ScreenUpdating = True
  31.     MsgBox "整理完毕", vbInformation + vbOKOnly
  32. End Sub
复制代码
回复

使用道具 举报

发表于 2013-3-1 20:46 | 显示全部楼层
=IF(K2="y","0、","")&TEXT(SUM(LARGE(((L2:T2="y")*L$1:T$1),ROW($1:$9))*10^(ROW($1:$9)-1)),REPT("#、",COUNTIF(L2:T2,"y")-1)&"#")&IF(U2="y","、10","")
回复

使用道具 举报

发表于 2013-3-1 21:04 | 显示全部楼层    本楼为最佳答案   
新建 Microsoft Office Excel 工作表.rar (92.03 KB, 下载次数: 18)
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|Excel精英培训 ( 豫ICP备11015029号 )

GMT+8, 2024-5-21 19:48 , Processed in 0.339935 second(s), 13 queries , Gzip On, Yac On.

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表