MINUS operation on Array elements

后端 未结 3 1678
忘掉有多难
忘掉有多难 2021-01-16 07:47

I have an Array say A=(11,23,32,44,56,88,55,14,78,79) And B=(44,56,88,55,14) .Now using VBScript can I perform Set operation MINUS to get an other

相关标签:
3条回答
  • 2021-01-16 08:09

    You can do that in Excel vba if u have named ranges Acol Bcol

    Range("C3:C10").FormulaArray = "=Acol-Bcol"
    
    0 讨论(0)
  • 2021-01-16 08:11

    No, vbs or vba cannot directly do a minus operation on two array ( no build-in function ) You must use loops and here is a good reference for array operations in vba http://www.cpearson.com/excel/vbaarrays.htm

    0 讨论(0)
  • 2021-01-16 08:15

    Perhaps it's not a surprise that Dictionaries are the VBScript tool to implement (fake?) sets and operations on them. See this Set demo.

    BTW: If you have to deal with more than one thingy, you'll have to loop or ask someone else to loop for you. Insisting on "no loop, please" makes no sense. If 'it works', you may optimize by replacing multiple loops (n x m .. x z) by lookup tables or pre-computations, but you won't understand the problem, if you don't think of loopings.

    0 讨论(0)
提交回复
热议问题