help require for algebra function??

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Norman Fritag

    help require for algebra function??

    Hi there
    I need some help, to matching data!
    eg: out of 20 elements: eg (10,2,4 17,24,5,30, 40, 50, 100, 23, 35, 200,
    3501, 201, 245, 323,2000, 33, 44,265,etc)
    I would want to know which of these elements eg: make up the sum 275??
    in this example the combination: 245,30 = 275 ; 200,24,50 =275;
    200,30,40,5 = 275 and so forth
    Would I have to use vba code function and or could I us as well sql?

    any hints are much appreciated

    Regards

    Norman


  • Terry Kreft

    #2
    Re: help require for algebra function??

    My first thought is there are 20! combinations here which is (according to
    calc <g>) 405483668029439 994.

    So good luck with that.



    --

    Terry Kreft


    "Norman Fritag" <muenchr@ozemai l.com.au> wrote in message
    news:43fc670f$0 $12197$5a62ac22 @per-qv1-newsreader-01.iinet.net.au ...[color=blue]
    > Hi there
    > I need some help, to matching data!
    > eg: out of 20 elements: eg (10,2,4 17,24,5,30, 40, 50, 100, 23, 35, 200,
    > 3501, 201, 245, 323,2000, 33, 44,265,etc)
    > I would want to know which of these elements eg: make up the sum 275??
    > in this example the combination: 245,30 = 275 ; 200,24,50 =275;
    > 200,30,40,5 = 275 and so forth
    > Would I have to use vba code function and or could I us as well sql?
    >
    > any hints are much appreciated
    >
    > Regards
    >
    > Norman
    >
    >[/color]


    Comment

    • Anthony England

      #3
      Re: help require for algebra function??


      "Terry Kreft" <terry.kreft@mp s.co.uk> wrote in message
      news:ZUmdnSKGe-T87WHeSa8jmw@ka roo.co.uk...[color=blue]
      > My first thought is there are 20! combinations here which is (according to
      > calc <g>) 405483668029439 994.
      >
      > So good luck with that.
      >
      >
      >
      > --
      >
      > Terry Kreft[/color]


      Are you sure that's correct? Each of the elements can appear either 1 or 0
      times so we've only got to check 2^20 sets.

      [color=blue]
      > "Norman Fritag" <muenchr@ozemai l.com.au> wrote in message
      > news:43fc670f$0 $12197$5a62ac22 @per-qv1-newsreader-01.iinet.net.au ...[color=green]
      >> Hi there
      >> I need some help, to matching data!
      >> eg: out of 20 elements: eg (10,2,4 17,24,5,30, 40, 50, 100, 23, 35, 200,
      >> 3501, 201, 245, 323,2000, 33, 44,265,etc)
      >> I would want to know which of these elements eg: make up the sum 275??
      >> in this example the combination: 245,30 = 275 ; 200,24,50 =275;
      >> 200,30,40,5 = 275 and so forth
      >> Would I have to use vba code function and or could I us as well sql?
      >>
      >> any hints are much appreciated
      >>
      >> Regards
      >>
      >> Norman[/color][/color]


      Comment

      • Anthony England

        #4
        Re: help require for algebra function??


        "Anthony England" <aengland@oops. co.uk> wrote in message
        news:dthskq$in5 $1@nwrdmz01.dmz .ncs.ea.ibs-infra.bt.com...[color=blue]
        >
        > "Terry Kreft" <terry.kreft@mp s.co.uk> wrote in message
        > news:ZUmdnSKGe-T87WHeSa8jmw@ka roo.co.uk...[color=green]
        >> My first thought is there are 20! combinations here which is (according
        >> to
        >> calc <g>) 405483668029439 994.
        >>
        >> So good luck with that.
        >>
        >>
        >>
        >> --
        >>
        >> Terry Kreft[/color]
        >
        >
        > Are you sure that's correct? Each of the elements can appear either 1 or
        > 0 times so we've only got to check 2^20 sets.
        >
        >[color=green]
        >> "Norman Fritag" <muenchr@ozemai l.com.au> wrote in message
        >> news:43fc670f$0 $12197$5a62ac22 @per-qv1-newsreader-01.iinet.net.au ...[color=darkred]
        >>> Hi there
        >>> I need some help, to matching data!
        >>> eg: out of 20 elements: eg (10,2,4 17,24,5,30, 40, 50, 100, 23, 35, 200,
        >>> 3501, 201, 245, 323,2000, 33, 44,265,etc)
        >>> I would want to know which of these elements eg: make up the sum 275??
        >>> in this example the combination: 245,30 = 275 ; 200,24,50 =275;
        >>> 200,30,40,5 = 275 and so forth
        >>> Would I have to use vba code function and or could I us as well sql?
        >>>
        >>> any hints are much appreciated
        >>>
        >>> Regards
        >>>
        >>> Norman[/color][/color][/color]


        As nobody else seems to want to have a go, here is a first attempt. It
        might be possible to optimize but I suppose it depends whether current
        performance is acceptable. With the example you gave, I found 103 matches
        in 5.89 seconds which may be acceptable to you, but just note that I wrote
        this bit of code on a whim and haven't had time to prove to myself that all
        matches will be found. However, it does seem to work Comments anyone?


        ' *************** **************
        ' Paste all this in a new module
        ' *************** **************
        Option Compare Database
        Option Explicit

        Public Sub DoTest()

        On Error GoTo Err_Handler

        Dim strSeries As String
        Dim lngSum As Long
        Dim strAllMatches As String
        Dim astrSeries() As String
        Dim astrNumbers() As String
        Dim strTemp As String
        Dim lngMatchCount As Long
        Dim sngTime As Single
        Dim lngX As Long
        Dim lngY As Long

        sngTime = Timer

        strSeries = "10,2,4,17,24,5 ,30,40,50," & _
        "100,23,35,200, 3501,201," & _
        "245,323,2000,3 3,44"

        lngSum = 275

        strAllMatches = GetAllMatches(l ngSum, strSeries)

        astrSeries() = Split(strAllMat ches, ";")

        For lngX = LBound(astrSeri es) To UBound(astrSeri es)

        strTemp = CStr(lngSum) & " = "

        astrNumbers = Split(astrSerie s(lngX), ",")

        For lngY = LBound(astrNumb ers) To UBound(astrNumb ers)
        strTemp = strTemp & astrNumbers(lng Y) & " + "
        Next lngY

        strTemp = Left$(strTemp, Len(strTemp) - 3)

        lngMatchCount = lngMatchCount + 1

        Debug.Print strTemp

        Next lngX

        sngTime = Timer - sngTime

        MsgBox CStr(lngMatchCo unt) & " matches found in " & _
        CStr(sngTime) & " seconds", vbInformation

        Exit_Handler:
        Exit Sub

        Err_Handler:
        MsgBox Err.Description , vbExclamation, "Error No: " & Err.Number
        Resume Exit_Handler

        End Sub


        Private Function GetAllMatches(l ngTargetSum As Long, strSeries As String) As
        String

        Dim strReturn As String
        Dim astrValues() As String
        Dim alngValues() As Long
        Dim strValue As String
        Dim lngCount As Long
        Dim lngMax As Long

        astrValues = Split(strSeries , ",")

        ReDim alngValues(LBou nd(astrValues) To UBound(astrValu es))

        For lngCount = LBound(astrValu es) To UBound(astrValu es)
        alngValues(lngC ount) = CLng(astrValues (lngCount))
        Next lngCount

        lngMax = (2 ^ (UBound(alngVal ues) + 1)) - 1

        For lngCount = 0 To lngMax
        strSeries = GetMatches(lngC ount, lngTargetSum, alngValues)
        If Len(strSeries) > 0 Then
        strReturn = strReturn & ";" & strSeries
        End If
        Next lngCount

        If Len(strReturn) > 1 Then
        strReturn = Mid$(strReturn, 2)
        End If

        GetAllMatches = strReturn

        End Function

        Private Function GetMatches(lngB its As Long, _
        lngTarget As Long, _
        aNumbers() As Long) As String

        Dim lngCount As Long
        Dim lngSum As Long
        Dim strReturn As String

        For lngCount = 0 To UBound(aNumbers )
        If (2 ^ lngCount And lngBits) = 0 Then
        lngSum = lngSum + aNumbers(lngCou nt)
        If lngSum > lngTarget Then
        Exit For
        End If
        End If
        Next lngCount

        If lngSum = lngTarget Then
        For lngCount = 0 To UBound(aNumbers )
        If (2 ^ lngCount And lngBits) = 0 Then
        strReturn = strReturn & "," & CStr(aNumbers(l ngCount))
        End If
        Next lngCount
        If Len(strReturn) > 1 Then
        strReturn = Mid$(strReturn, 2)
        End If
        End If

        GetMatches = strReturn

        End Function
        ' *************** **********
        ' Code End
        ' *************** **********



        Results from debug window:
        275 = 40 + 100 + 23 + 35 + 33 + 44
        275 = 10 + 30 + 100 + 23 + 35 + 33 + 44
        275 = 10 + 2 + 4 + 24 + 100 + 23 + 35 + 33 + 44
        275 = 4 + 17 + 24 + 5 + 40 + 50 + 23 + 35 + 33 + 44
        275 = 10 + 4 + 17 + 24 + 5 + 30 + 50 + 23 + 35 + 33 + 44
        275 = 2 + 4 + 17 + 40 + 100 + 35 + 33 + 44
        275 = 4 + 24 + 5 + 30 + 100 + 35 + 33 + 44
        275 = 10 + 2 + 4 + 17 + 30 + 100 + 35 + 33 + 44
        275 = 10 + 4 + 24 + 5 + 30 + 40 + 50 + 35 + 33 + 44
        275 = 2 + 17 + 24 + 30 + 40 + 50 + 35 + 33 + 44
        275 = 5 + 30 + 40 + 100 + 23 + 33 + 44
        275 = 2 + 4 + 24 + 5 + 40 + 100 + 23 + 33 + 44
        275 = 10 + 2 + 4 + 24 + 5 + 30 + 100 + 23 + 33 + 44
        275 = 4 + 17 + 24 + 30 + 100 + 23 + 33 + 44
        275 = 10 + 4 + 17 + 24 + 30 + 40 + 50 + 23 + 33 + 44
        275 = 2 + 17 + 24 + 5 + 50 + 100 + 33 + 44
        275 = 2 + 4 + 17 + 5 + 30 + 40 + 100 + 33 + 44
        275 = 4 + 24 + 30 + 40 + 100 + 33 + 44
        275 = 10 + 2 + 17 + 24 + 5 + 40 + 100 + 33 + 44
        275 = 2 + 5 + 23 + 201 + 44
        275 = 30 + 201 + 44
        275 = 2 + 4 + 24 + 201 + 44
        275 = 2 + 24 + 5 + 200 + 44
        275 = 10 + 4 + 17 + 200 + 44
        275 = 2 + 4 + 17 + 50 + 100 + 23 + 35 + 44
        275 = 4 + 24 + 5 + 40 + 100 + 23 + 35 + 44
        275 = 10 + 2 + 4 + 17 + 40 + 100 + 23 + 35 + 44
        275 = 10 + 4 + 24 + 5 + 30 + 100 + 23 + 35 + 44
        275 = 2 + 17 + 24 + 30 + 100 + 23 + 35 + 44
        275 = 10 + 2 + 17 + 24 + 30 + 40 + 50 + 23 + 35 + 44
        275 = 2 + 4 + 40 + 50 + 100 + 35 + 44
        275 = 10 + 2 + 4 + 30 + 50 + 100 + 35 + 44
        275 = 17 + 24 + 5 + 50 + 100 + 35 + 44
        275 = 4 + 17 + 5 + 30 + 40 + 100 + 35 + 44
        275 = 2 + 24 + 30 + 40 + 100 + 35 + 44
        275 = 10 + 17 + 24 + 5 + 40 + 100 + 35 + 44
        275 = 2 + 4 + 17 + 5 + 30 + 50 + 100 + 23 + 44
        275 = 4 + 24 + 30 + 50 + 100 + 23 + 44
        275 = 10 + 2 + 17 + 24 + 5 + 50 + 100 + 23 + 44
        275 = 10 + 2 + 4 + 17 + 5 + 30 + 40 + 100 + 23 + 44
        275 = 10 + 4 + 24 + 30 + 40 + 100 + 23 + 44
        275 = 2 + 4 + 5 + 30 + 40 + 50 + 100 + 44
        275 = 10 + 2 + 24 + 5 + 40 + 50 + 100 + 44
        275 = 17 + 24 + 40 + 50 + 100 + 44
        275 = 10 + 17 + 24 + 30 + 50 + 100 + 44
        275 = 2 + 4 + 35 + 201 + 33
        275 = 2 + 4 + 5 + 30 + 201 + 33
        275 = 10 + 2 + 24 + 5 + 201 + 33
        275 = 17 + 24 + 201 + 33
        275 = 2 + 5 + 35 + 200 + 33
        275 = 10 + 4 + 5 + 23 + 200 + 33
        275 = 2 + 17 + 23 + 200 + 33
        275 = 2 + 40 + 200 + 33
        275 = 10 + 2 + 30 + 200 + 33
        275 = 4 + 30 + 50 + 100 + 23 + 35 + 33
        275 = 10 + 2 + 17 + 5 + 50 + 100 + 23 + 35 + 33
        275 = 10 + 24 + 50 + 100 + 23 + 35 + 33
        275 = 10 + 4 + 30 + 40 + 100 + 23 + 35 + 33
        275 = 10 + 2 + 5 + 40 + 50 + 100 + 35 + 33
        275 = 17 + 40 + 50 + 100 + 35 + 33
        275 = 10 + 17 + 30 + 50 + 100 + 35 + 33
        275 = 10 + 2 + 4 + 17 + 24 + 50 + 100 + 35 + 33
        275 = 24 + 5 + 40 + 50 + 100 + 23 + 33
        275 = 10 + 2 + 17 + 40 + 50 + 100 + 23 + 33
        275 = 10 + 24 + 5 + 30 + 50 + 100 + 23 + 33
        275 = 17 + 5 + 30 + 40 + 50 + 100 + 33
        275 = 2 + 4 + 17 + 24 + 5 + 40 + 50 + 100 + 33
        275 = 10 + 2 + 4 + 17 + 24 + 5 + 30 + 50 + 100 + 33
        275 = 2 + 5 + 23 + 245
        275 = 30 + 245
        275 = 2 + 4 + 24 + 245
        275 = 10 + 2 + 4 + 23 + 35 + 201
        275 = 4 + 5 + 30 + 35 + 201
        275 = 10 + 24 + 5 + 35 + 201
        275 = 2 + 4 + 5 + 40 + 23 + 201
        275 = 10 + 2 + 4 + 5 + 30 + 23 + 201
        275 = 4 + 17 + 30 + 23 + 201
        275 = 10 + 17 + 24 + 23 + 201
        275 = 2 + 17 + 5 + 50 + 201
        275 = 24 + 50 + 201
        275 = 4 + 30 + 40 + 201
        275 = 10 + 2 + 17 + 5 + 40 + 201
        275 = 10 + 24 + 40 + 201
        275 = 10 + 2 + 5 + 23 + 35 + 200
        275 = 17 + 23 + 35 + 200
        275 = 40 + 35 + 200
        275 = 10 + 30 + 35 + 200
        275 = 10 + 2 + 4 + 24 + 35 + 200
        275 = 2 + 50 + 23 + 200
        275 = 10 + 2 + 40 + 23 + 200
        275 = 17 + 5 + 30 + 23 + 200
        275 = 2 + 4 + 17 + 24 + 5 + 23 + 200
        275 = 5 + 30 + 40 + 200
        275 = 2 + 4 + 24 + 5 + 40 + 200
        275 = 10 + 2 + 4 + 24 + 5 + 30 + 200
        275 = 4 + 17 + 24 + 30 + 200
        275 = 10 + 17 + 40 + 50 + 100 + 23 + 35
        275 = 2 + 4 + 17 + 24 + 30 + 40 + 100 + 23 + 35
        275 = 4 + 17 + 24 + 5 + 40 + 50 + 100 + 35
        275 = 10 + 4 + 17 + 24 + 5 + 30 + 50 + 100 + 35
        275 = 10 + 17 + 5 + 30 + 40 + 50 + 100 + 23
        275 = 10 + 2 + 4 + 17 + 24 + 5 + 40 + 50 + 100 + 23
        275 = 10 + 4 + 17 + 24 + 30 + 40 + 50 + 100


        Comment

        • Anthony England

          #5
          Re: help require for algebra function??


          "Norman Fritag" <muenchr@ozemai l.com.au> wrote in message
          news:43fc670f$0 $12197$5a62ac22 @per-qv1-newsreader-01.iinet.net.au ...[color=blue]
          > Hi there
          > I need some help, to matching data!
          > eg: out of 20 elements: eg (10,2,4 17,24,5,30, 40, 50, 100, 23, 35, 200,
          > 3501, 201, 245, 323,2000, 33, 44,265,etc)
          > I would want to know which of these elements eg: make up the sum 275??
          > in this example the combination: 245,30 = 275 ; 200,24,50 =275;
          > 200,30,40,5 = 275 and so forth
          > Would I have to use vba code function and or could I us as well sql?
          >
          > any hints are much appreciated
          >
          > Regards
          >
          > Norman[/color]


          As nobody else seems to want to have a go, here is a first attempt. It
          might be possible to optimize but I suppose it depends whether current
          performance is acceptable. With the example you gave, I found 103 matches
          in 5.89 seconds which may be acceptable to you, but just note that I wrote
          this bit of code on a whim and haven't had time to prove to myself that all
          matches will be found. However, it does seem to work Comments anyone?


          ' *************** **************
          ' Paste all this in a new module
          ' *************** **************
          Option Compare Database
          Option Explicit

          Public Sub DoTest()

          On Error GoTo Err_Handler

          Dim strSeries As String
          Dim lngSum As Long
          Dim strAllMatches As String
          Dim astrSeries() As String
          Dim astrNumbers() As String
          Dim strTemp As String
          Dim lngMatchCount As Long
          Dim sngTime As Single
          Dim lngX As Long
          Dim lngY As Long

          sngTime = Timer

          strSeries = "10,2,4,17,24,5 ,30,40,50," & _
          "100,23,35,200, 3501,201," & _
          "245,323,2000,3 3,44"

          lngSum = 275

          strAllMatches = GetAllMatches(l ngSum, strSeries)

          astrSeries() = Split(strAllMat ches, ";")

          For lngX = LBound(astrSeri es) To UBound(astrSeri es)

          strTemp = CStr(lngSum) & " = "

          astrNumbers = Split(astrSerie s(lngX), ",")

          For lngY = LBound(astrNumb ers) To UBound(astrNumb ers)
          strTemp = strTemp & astrNumbers(lng Y) & " + "
          Next lngY

          strTemp = Left$(strTemp, Len(strTemp) - 3)

          lngMatchCount = lngMatchCount + 1

          Debug.Print strTemp

          Next lngX

          sngTime = Timer - sngTime

          MsgBox CStr(lngMatchCo unt) & " matches found in " & _
          CStr(sngTime) & " seconds", vbInformation

          Exit_Handler:
          Exit Sub

          Err_Handler:
          MsgBox Err.Description , vbExclamation, "Error No: " & Err.Number
          Resume Exit_Handler

          End Sub


          Private Function GetAllMatches(l ngTargetSum As Long, strSeries As String) As
          String

          Dim strReturn As String
          Dim astrValues() As String
          Dim alngValues() As Long
          Dim strValue As String
          Dim lngCount As Long
          Dim lngMax As Long

          astrValues = Split(strSeries , ",")

          ReDim alngValues(LBou nd(astrValues) To UBound(astrValu es))

          For lngCount = LBound(astrValu es) To UBound(astrValu es)
          alngValues(lngC ount) = CLng(astrValues (lngCount))
          Next lngCount

          lngMax = (2 ^ (UBound(alngVal ues) + 1)) - 1

          For lngCount = 0 To lngMax
          strSeries = GetMatches(lngC ount, lngTargetSum, alngValues)
          If Len(strSeries) > 0 Then
          strReturn = strReturn & ";" & strSeries
          End If
          Next lngCount

          If Len(strReturn) > 1 Then
          strReturn = Mid$(strReturn, 2)
          End If

          GetAllMatches = strReturn

          End Function

          Private Function GetMatches(lngB its As Long, _
          lngTarget As Long, _
          aNumbers() As Long) As String

          Dim lngCount As Long
          Dim lngSum As Long
          Dim strReturn As String

          For lngCount = 0 To UBound(aNumbers )
          If (2 ^ lngCount And lngBits) = 0 Then
          lngSum = lngSum + aNumbers(lngCou nt)
          If lngSum > lngTarget Then
          Exit For
          End If
          End If
          Next lngCount

          If lngSum = lngTarget Then
          For lngCount = 0 To UBound(aNumbers )
          If (2 ^ lngCount And lngBits) = 0 Then
          strReturn = strReturn & "," & CStr(aNumbers(l ngCount))
          End If
          Next lngCount
          If Len(strReturn) > 1 Then
          strReturn = Mid$(strReturn, 2)
          End If
          End If

          GetMatches = strReturn

          End Function
          ' *************** **********
          ' Code End
          ' *************** **********



          Results from debug window:
          275 = 40 + 100 + 23 + 35 + 33 + 44
          275 = 10 + 30 + 100 + 23 + 35 + 33 + 44
          275 = 10 + 2 + 4 + 24 + 100 + 23 + 35 + 33 + 44
          275 = 4 + 17 + 24 + 5 + 40 + 50 + 23 + 35 + 33 + 44
          275 = 10 + 4 + 17 + 24 + 5 + 30 + 50 + 23 + 35 + 33 + 44
          275 = 2 + 4 + 17 + 40 + 100 + 35 + 33 + 44
          275 = 4 + 24 + 5 + 30 + 100 + 35 + 33 + 44
          275 = 10 + 2 + 4 + 17 + 30 + 100 + 35 + 33 + 44
          275 = 10 + 4 + 24 + 5 + 30 + 40 + 50 + 35 + 33 + 44
          275 = 2 + 17 + 24 + 30 + 40 + 50 + 35 + 33 + 44
          275 = 5 + 30 + 40 + 100 + 23 + 33 + 44
          275 = 2 + 4 + 24 + 5 + 40 + 100 + 23 + 33 + 44
          275 = 10 + 2 + 4 + 24 + 5 + 30 + 100 + 23 + 33 + 44
          275 = 4 + 17 + 24 + 30 + 100 + 23 + 33 + 44
          275 = 10 + 4 + 17 + 24 + 30 + 40 + 50 + 23 + 33 + 44
          275 = 2 + 17 + 24 + 5 + 50 + 100 + 33 + 44
          275 = 2 + 4 + 17 + 5 + 30 + 40 + 100 + 33 + 44
          275 = 4 + 24 + 30 + 40 + 100 + 33 + 44
          275 = 10 + 2 + 17 + 24 + 5 + 40 + 100 + 33 + 44
          275 = 2 + 5 + 23 + 201 + 44
          275 = 30 + 201 + 44
          275 = 2 + 4 + 24 + 201 + 44
          275 = 2 + 24 + 5 + 200 + 44
          275 = 10 + 4 + 17 + 200 + 44
          275 = 2 + 4 + 17 + 50 + 100 + 23 + 35 + 44
          275 = 4 + 24 + 5 + 40 + 100 + 23 + 35 + 44
          275 = 10 + 2 + 4 + 17 + 40 + 100 + 23 + 35 + 44
          275 = 10 + 4 + 24 + 5 + 30 + 100 + 23 + 35 + 44
          275 = 2 + 17 + 24 + 30 + 100 + 23 + 35 + 44
          275 = 10 + 2 + 17 + 24 + 30 + 40 + 50 + 23 + 35 + 44
          275 = 2 + 4 + 40 + 50 + 100 + 35 + 44
          275 = 10 + 2 + 4 + 30 + 50 + 100 + 35 + 44
          275 = 17 + 24 + 5 + 50 + 100 + 35 + 44
          275 = 4 + 17 + 5 + 30 + 40 + 100 + 35 + 44
          275 = 2 + 24 + 30 + 40 + 100 + 35 + 44
          275 = 10 + 17 + 24 + 5 + 40 + 100 + 35 + 44
          275 = 2 + 4 + 17 + 5 + 30 + 50 + 100 + 23 + 44
          275 = 4 + 24 + 30 + 50 + 100 + 23 + 44
          275 = 10 + 2 + 17 + 24 + 5 + 50 + 100 + 23 + 44
          275 = 10 + 2 + 4 + 17 + 5 + 30 + 40 + 100 + 23 + 44
          275 = 10 + 4 + 24 + 30 + 40 + 100 + 23 + 44
          275 = 2 + 4 + 5 + 30 + 40 + 50 + 100 + 44
          275 = 10 + 2 + 24 + 5 + 40 + 50 + 100 + 44
          275 = 17 + 24 + 40 + 50 + 100 + 44
          275 = 10 + 17 + 24 + 30 + 50 + 100 + 44
          275 = 2 + 4 + 35 + 201 + 33
          275 = 2 + 4 + 5 + 30 + 201 + 33
          275 = 10 + 2 + 24 + 5 + 201 + 33
          275 = 17 + 24 + 201 + 33
          275 = 2 + 5 + 35 + 200 + 33
          275 = 10 + 4 + 5 + 23 + 200 + 33
          275 = 2 + 17 + 23 + 200 + 33
          275 = 2 + 40 + 200 + 33
          275 = 10 + 2 + 30 + 200 + 33
          275 = 4 + 30 + 50 + 100 + 23 + 35 + 33
          275 = 10 + 2 + 17 + 5 + 50 + 100 + 23 + 35 + 33
          275 = 10 + 24 + 50 + 100 + 23 + 35 + 33
          275 = 10 + 4 + 30 + 40 + 100 + 23 + 35 + 33
          275 = 10 + 2 + 5 + 40 + 50 + 100 + 35 + 33
          275 = 17 + 40 + 50 + 100 + 35 + 33
          275 = 10 + 17 + 30 + 50 + 100 + 35 + 33
          275 = 10 + 2 + 4 + 17 + 24 + 50 + 100 + 35 + 33
          275 = 24 + 5 + 40 + 50 + 100 + 23 + 33
          275 = 10 + 2 + 17 + 40 + 50 + 100 + 23 + 33
          275 = 10 + 24 + 5 + 30 + 50 + 100 + 23 + 33
          275 = 17 + 5 + 30 + 40 + 50 + 100 + 33
          275 = 2 + 4 + 17 + 24 + 5 + 40 + 50 + 100 + 33
          275 = 10 + 2 + 4 + 17 + 24 + 5 + 30 + 50 + 100 + 33
          275 = 2 + 5 + 23 + 245
          275 = 30 + 245
          275 = 2 + 4 + 24 + 245
          275 = 10 + 2 + 4 + 23 + 35 + 201
          275 = 4 + 5 + 30 + 35 + 201
          275 = 10 + 24 + 5 + 35 + 201
          275 = 2 + 4 + 5 + 40 + 23 + 201
          275 = 10 + 2 + 4 + 5 + 30 + 23 + 201
          275 = 4 + 17 + 30 + 23 + 201
          275 = 10 + 17 + 24 + 23 + 201
          275 = 2 + 17 + 5 + 50 + 201
          275 = 24 + 50 + 201
          275 = 4 + 30 + 40 + 201
          275 = 10 + 2 + 17 + 5 + 40 + 201
          275 = 10 + 24 + 40 + 201
          275 = 10 + 2 + 5 + 23 + 35 + 200
          275 = 17 + 23 + 35 + 200
          275 = 40 + 35 + 200
          275 = 10 + 30 + 35 + 200
          275 = 10 + 2 + 4 + 24 + 35 + 200
          275 = 2 + 50 + 23 + 200
          275 = 10 + 2 + 40 + 23 + 200
          275 = 17 + 5 + 30 + 23 + 200
          275 = 2 + 4 + 17 + 24 + 5 + 23 + 200
          275 = 5 + 30 + 40 + 200
          275 = 2 + 4 + 24 + 5 + 40 + 200
          275 = 10 + 2 + 4 + 24 + 5 + 30 + 200
          275 = 4 + 17 + 24 + 30 + 200
          275 = 10 + 17 + 40 + 50 + 100 + 23 + 35
          275 = 2 + 4 + 17 + 24 + 30 + 40 + 100 + 23 + 35
          275 = 4 + 17 + 24 + 5 + 40 + 50 + 100 + 35
          275 = 10 + 4 + 17 + 24 + 5 + 30 + 50 + 100 + 35
          275 = 10 + 17 + 5 + 30 + 40 + 50 + 100 + 23
          275 = 10 + 2 + 4 + 17 + 24 + 5 + 40 + 50 + 100 + 23
          275 = 10 + 4 + 17 + 24 + 30 + 40 + 50 + 100


          Comment

          • Terry Kreft

            #6
            Re: help require for algebra function??

            Nope, that's why I said it was a first thought <g>.

            --

            Terry Kreft


            "Anthony England" <aengland@oops. co.uk> wrote in message
            news:dthskq$in5 $1@nwrdmz01.dmz .ncs.ea.ibs-infra.bt.com...[color=blue]
            >
            > "Terry Kreft" <terry.kreft@mp s.co.uk> wrote in message
            > news:ZUmdnSKGe-T87WHeSa8jmw@ka roo.co.uk...[color=green]
            > > My first thought is there are 20! combinations here which is (according[/color][/color]
            to[color=blue][color=green]
            > > calc <g>) 405483668029439 994.
            > >
            > > So good luck with that.
            > >
            > >
            > >
            > > --
            > >
            > > Terry Kreft[/color]
            >
            >
            > Are you sure that's correct? Each of the elements can appear either 1 or[/color]
            0[color=blue]
            > times so we've only got to check 2^20 sets.
            >
            >[color=green]
            > > "Norman Fritag" <muenchr@ozemai l.com.au> wrote in message
            > > news:43fc670f$0 $12197$5a62ac22 @per-qv1-newsreader-01.iinet.net.au ...[color=darkred]
            > >> Hi there
            > >> I need some help, to matching data!
            > >> eg: out of 20 elements: eg (10,2,4 17,24,5,30, 40, 50, 100, 23, 35,[/color][/color][/color]
            200,[color=blue][color=green][color=darkred]
            > >> 3501, 201, 245, 323,2000, 33, 44,265,etc)
            > >> I would want to know which of these elements eg: make up the sum 275??
            > >> in this example the combination: 245,30 = 275 ; 200,24,50 =275;
            > >> 200,30,40,5 = 275 and so forth
            > >> Would I have to use vba code function and or could I us as well sql?
            > >>
            > >> any hints are much appreciated
            > >>
            > >> Regards
            > >>
            > >> Norman[/color][/color]
            >
            >[/color]


            Comment

            Working...