NeedyHelpExcelMan
New Member
- Joined
- Jun 25, 2014
- Messages
- 17
Hello world:
So I am building a spreadsheet that has multple rows of data and criteria. The objective is to have a value of F3 (given criteria in column B) minus the median of values of column F (given the same criteria of column B). I am trying the code apply to the entirity of column F. My code is as follows:
Dim JCode As Variant</SPAN>
Dim Diff As Variant</SPAN>
Dim SalR As Range</SPAN>
Dim Sal As Variant</SPAN>
Dim N1 As Double, i1 As Double</SPAN>
N = Application.WorksheetFunction.CountA(Range(Range(“B3”), Range(“B3”)).End(xlDown)</SPAN>
For i1 = 1 To N1</SPAN>
JCode = “10000”</SPAN>
Set SalR = </SPAN>
Sal = Range(“B2”).Offset(i1, 4).Value </SPAN>
Diff = Range(“B2”).Offset(i1, 5).Value = Application.WorksheetFunction.Sum(Range(“Sal”)-Median(“SalR”)</SPAN>
My question is how to define a range so that it pulls all values that are subject to the criteria of JCode. And also, if the definition of Diff is accurate. And lastly, what code to write from here on out.
Thanks in advance for any advice.
So I am building a spreadsheet that has multple rows of data and criteria. The objective is to have a value of F3 (given criteria in column B) minus the median of values of column F (given the same criteria of column B). I am trying the code apply to the entirity of column F. My code is as follows:
Dim JCode As Variant</SPAN>
Dim Diff As Variant</SPAN>
Dim SalR As Range</SPAN>
Dim Sal As Variant</SPAN>
Dim N1 As Double, i1 As Double</SPAN>
N = Application.WorksheetFunction.CountA(Range(Range(“B3”), Range(“B3”)).End(xlDown)</SPAN>
For i1 = 1 To N1</SPAN>
JCode = “10000”</SPAN>
Set SalR = </SPAN>
Sal = Range(“B2”).Offset(i1, 4).Value </SPAN>
Diff = Range(“B2”).Offset(i1, 5).Value = Application.WorksheetFunction.Sum(Range(“Sal”)-Median(“SalR”)</SPAN>
My question is how to define a range so that it pulls all values that are subject to the criteria of JCode. And also, if the definition of Diff is accurate. And lastly, what code to write from here on out.
Thanks in advance for any advice.