PDA

View Full Version : subtraction



oleg_v
05-24-2010, 03:41 AM
hi
how can i make a subtraction between 2 lines after making auto filter
write the results on adifferent sheet and each time when i choose a different data in the filter i see the subtraction results in the same place


thanks

mdmackillop
05-24-2010, 04:41 AM
Too obscure

oleg_v
05-24-2010, 04:46 AM
hi
i do not know how to explain any better

i have an auto filter each time i choose a number 2 rows com up it actually a measurement results i just want to see the deference between them

GTO
05-24-2010, 04:50 AM
Hi Oleg,

Malcom is of course correct. If you are having a hard time 'painting a verbal picture', why not attach a tiny example wb showing us what you mean?

Mark

oleg_v
05-24-2010, 04:57 AM
hi
see attached file in the data column i choose the serial number and under 'deferese" i must see the diferese between 2 rows or lines

Aussiebear
05-24-2010, 03:16 PM
What does "deferese" mean?

Aussiebear
05-24-2010, 03:26 PM
I've had a third look at your workbook and still cannot understand what it is that you are chasing.

Which two lines are you chasing to subtract? You currently have a data range of B3:R112 which you filter based on a selection in cell R2.

There is some data existing in Column S and in range U113:AJ113 as well as B3:R112.

How does this data relate to each other?

oleg_v
05-24-2010, 05:25 PM
Hi
When I choose the serial with filter in cell r2 I have two answers those two line I am trying to
subtract column by column meaning what I column b must be substracted one from the
Other and so on.
The answer to the substruction will be written uner the header "deferences" each time I choose
The diferent serial in r2 cell the deferense changes.

Aussiebear
05-24-2010, 10:06 PM
oleg, I am getting very frustrated here with your responses. Using the data sheet you supplied as the example, your current filter value in cell R2 is 7180 and has enabled row range B22:S22 and B43:S43 to be visible.

As I currently understand your request, you would like these two ranges to be subtracted from each other, and the resultant values to be written under the heading of "Deferense" in the range U113AJ113.

One has 18 values and the other one has 16 values, so which values do not count?

Currently the value in cell U113 is derived from a formula "=B3-B9" , yet we cannot view what values these are because we cannot see the data to which this formula works upon.

Am I also correct in assuming that when saying "Deferense" you might mean "Difference"

oleg_v
05-24-2010, 10:20 PM
i see
i started a code to do the substraction in column "p"
what you think:
Sub substr()

Dim k As Double
Dim i As Long, y As Long, h As Long
y = Sheets("sheet2").Range("p65536").End(xlUp).row
myvar = Sheets("sheet2").Cells(y, 16).Value
m = y - 1
h = Sheets("sheet2").Range("p" & m).End(xlUp).row
myvar2 = Sheets("sheet2").Cells(h, 16).Value
k = (myvar2 - myvar)

End Sub