simplification problem (only for expert!)
it only looks at sums of adjacent cells.
--
Regards,
Tom Ogilvy
"NickHK" wrote in message
...
Mark,
What's wrong with this, starting in A1:
200 10
30 50 =IF(AND((A1+A2)70,(B1+B2)70),A1+A2,0)
50 40 =IF(AND((A2+A3)70,(B2+B3)70),A2+A3,0)
10 20 =IF(AND((A3+A4)70,(B3+B4)70),A3+A4,0)
=MAX(C2:C4)
"Mark" wrote in message
...
it need recurrence..
-----Original Message-----
Hi
the worksheet formula is simply to adapt:
=IF(SUM(LARGE(A1:a100,{1,2}))70,SUM(LARGE(A1:a10 0,
{1,2})),"no sum 70 found")
And in VBA you could use the same approach without
iterating through the range. e.g.
Sub find_large_sum()
Dim rng As Range
Dim result
Set rng = ActiveSheet.Range("A:A")
With Application.WorksheetFunction
result = .Large(rng, 1) + .Large(rng, 2)
End With
If result 70 Then
MsgBox "Result is: " & result
Else
MsgBox "no sum larger than 70 found"
End If
End Sub
-----Original Message-----
becouse exist just nacessary condition...
read carefully my post
i'd like resolve in VBA..
-----Original Message-----
Hi
why not use a formula for this?. e.g.
=SUM(LARGE(A1:A100,{1,2}))
-----Original Message-----
Hi,
I struggling with the following problem.
I have in two column data:
column1 column2
200 10
30 50
50 40
10 20
....etc. thousand records
I'd like find max sum (two elements) of column1.
Nacessary condition: sum of these two element in
column2
70.
E.G. satisfy condition is:
sum of column1: 30+50 = 80
becouse condition is fulfil, sum of column2: 50+40 70
How resolve this task in VBA by selection and
iteration??
Many thanks in anticipation.
Regards
Mark
.
.
.
.
|