當前位置:編程學習大全網 - 網站源碼 - excel自定義公式wlookup改進

excel自定義公式wlookup改進

Function?WLOOKUP(X?As?Variant,?M?As?Range,?A?As?Byte,?B?As?Integer)

Dim?I?As?Integer,?MR?As?Range,?y?As?Integer

Dim?wl(255)

I?=?Application.WorksheetFunction.CountIf(M,?X)

For?Each?MR?In?M

If?MR.Value?=?X?Then

y?=?y?+?1

wl(y)?=?MR.Offset(0,?B?-?1).Value

If?y?>=?2?Then

For?n?=?1?To?y?-?1

If?wl(y)?=?wl(n)?Then

WLOOKUP?=?""

Exit?Function

End?If

Next?n

End?If

If?y?=?A?Then

WLOOKUP?=?MR.Offset(0,?B?-?1).Value

Exit?Function

End?If

End?If

Next?MR

WLOOKUP?=?""

End?Function

  • 上一篇:linux系統怎麽批量查找文件與文件內容
  • 下一篇:nodejs讀取pdf並翻轉內容保存pdf
  • copyright 2024編程學習大全網