IF / MEDIAN Nesting Function Help

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.
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.

Forum statistics

Threads
1,223,903
Messages
6,175,287
Members
452,631
Latest member
a_potato

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top