MEDIAN() As Array Function?
Oct 11, 2005
Is it possible to submit the MEDIAN() function as an array (ctrl + shift + enter)?
I.e., I would like to submit a function similar to this SUM() function:
{=SUM(IF(("a"=$A$1:$A$7),$B$1:$B$7,))}
However, when I submit
{=MEDIAN(IF(("a"=$A$1:$A$7),$B$1:$B$7,))}
it does not give me the intended result.
View 6 Replies
ADVERTISEMENT
Feb 18, 2008
Hi, Im using a array in Excel VBA, i got a method which looks at a element no of the array as as a return for that array, i have got it to sort the array, i just need some help to find the middle number (median) of the array.
View 6 Replies
View Related
Feb 1, 2007
I am using an array formula to calculate a median. This works except that bizarrely it counts blanks as values and when charted displays them as zero.
=MEDIAN(IF(INDIRECT(IJ13)=INDIRECT(" Analysis!"&IJ14),INDIRECT(IT28)))
So I am trying to add another criteria to the formula. I've tried a few variations, including the one below, but all return a #VALUE error.
=MEDIAN(IF(INDIRECT(IJ13)=INDIRECT("Analysis!"&IJ14)*(ISNUMBER(INDIRECT(IT28))),INDIRECT(IT28)))
When I stepped through the formula evaluation it seemed to evaluate all the blanks as zero. So the problem may be with the data but I can't think what.
Does anyone have any suggestions and/or workarounds?
View 9 Replies
View Related
May 9, 2006
for my thesis i need to create median industry multipliers. i have a list of
companies with their industry codes and multiples, but now i need to create a
list with medians per industry. is there a function similar to SUMIF for
medians?
View 11 Replies
View Related
Oct 7, 2008
I have two columns of data
1st - Multiple physician names (may be duplicate as data set is Emergency Room encounters)
2nd - Denotes the length of stay in minutes for each patient encounter
I want to develop a formula to calculate the median length of stay (off 2nd col) for every physician a select in a drop down.
View 4 Replies
View Related
Mar 6, 2014
We are trying to find the median of a large set of numbers to calculate the median income in 2010. For an example we have 8,379k people with $2500 average income, 9,783k with $7500 average income and so on. How can I calculate the median average income of such a large amount of entries?
View 8 Replies
View Related
Oct 16, 2013
I'm trying to get the Median (and min/max later) of certain values on a different sheet. For example, I'm operating in one sheet and pulling the values from the sheet "Form Responses". I want a median for numbers when the values in column B are "Aransas" and the values in column D are Yes. The values are in Column F. My formula is:
=MEDIAN(IF('Form Responses'!B:B="Aransas",IF('Form Responses'!D:D="Yes",'Form Responses'!F:F,""),""))
It's giving me the median for ALL of the numbers in F and I can't figure out why.
Following that, I'll want a median for all the numbers in F when column B value is "Aransas" (in other words, dropping the Column D condition).
Excel 2010, Windows 7
View 1 Replies
View Related
Nov 11, 2009
how to find the median for a list of numbers using =median(). But what if I have a list of prices for different types of say cars.
Car Type Price
A $10000
B $15000
A $20000
C $30000
Is there a macro that will return
Car Type Median
A $
B $
C $
View 2 Replies
View Related
Aug 8, 2012
I use a existing code and want to add the Concatenate in the code.
VB:
Sub Subtotal()
Dim myAreas As Areas, myArea As Range, x As String
Dim y As Long
Worksheets("INVOICE_hulp").Activate
Range("Q1").Select
[Code] ....
The array sum function works but Concatenate not. In Excel I get the formula Concatenate(H2:H3) in stead of Concatenate(H2,H3). What should I change to get the code working?
View 9 Replies
View Related
Sep 3, 2012
I want to create a function in a module that will read an array from sheet1 preform an operation on it then return the result to the spreadsheet in a defined amount of cells in this example 8.
In Module1:
VB:
Function func1(ByRef arrayA())
Dim arrayB(8)
For k = 0 To 7
[Code].....
How does the resultant arrayB get populated onto the spreadsheet?
View 5 Replies
View Related
May 2, 2014
I want to use the countif function for a certain array. The range is set by another cell which is made up out of a percentile of an entire row.
The problem is is that excel doesn't see the value it displays so i continuously get a value of 0 in the countif cell. If i fill in the range by hand, which is exactly the same range as the outcome of the percentile the countif cell does give the correct value.
So in short the problem is i guess that the countif cell does not recognize the value because this value is made up by a formula.
View 8 Replies
View Related
Jan 24, 2007
I am working on a Monthly Vehicle Spread Sheet. One of the outputs I am trying to achieve is an automatic calculation of Mile Per Gallon. To do this, I need to know if there is a function that will return the value of the first entry of a group of cells.
In calculating the miles per gallon, I need to subtract the first gallon amount entry of the total gallons in the month, then divide that number into the difference of the mileage in the month recorded when the vehicles fueled up.
View 11 Replies
View Related
Oct 15, 2008
Is there anyway I can do the below formula without it being an array formula?
View 2 Replies
View Related
Feb 21, 2014
I am trying to write a code for simulating a stock price using geometric brownian motion. I have the function part down as follows:
Public Function SimStock(Initial_Stock_Price As Double, _
Expected_Return As Double, _
Volitility As Double, _
End_Time_Days As Double, _
Number_of_Steps) As Double
SimStock = Initial_Stock_Price * Exp((Expected_Return - Volitility ^ 2 / 2) * (Number_of_Steps / End_Time_Days) * NRnd2() * Sqr((Number_of_Steps / End_Time_Days)))
End Function
Now what i need to do is to apply this to an array. so that when i run the sub it will simulate prices from today up to some number of days that i specify. This number of days will be equal to "End_Time_Days" which is part of my function. Furthermore the simulation has to be such that it uses the above formula for the first entry but then replaces "Initial_Stock_Price" with the result of the preceding entry in each subsequent entry.
View 1 Replies
View Related
Feb 27, 2012
For some reason my array called "PriceSum" is not getting load with values or not being summed. I am not sure if it is because I am trying to load a value with a decimal in it or not.
For logic purposes:
lastrow = 2
Stock = Banking
Cell "W2" = 5
Cell "X2" = 71.84
Cell "U2" = Bought
Cell "V2" = Banking
Code:
Private Sub Purchase_Click()Dim MyArray As Variant
Dim x As Integer
Dim t As Integer
Dim lastrow As Integer
Dim QuantityArray(0 To 1000) As Variant,
[Code] ...........
View 9 Replies
View Related
Jan 9, 2014
I have a big macro that runs whenever there is a change made. I'm not gonna link it all because I don't think that would be useful... This macro does:
1. Disables Events.
2. Removes Protection
3.Calls some macros that check a few values and change a few cells.
4. Activates events.
5. Hides or shows ranges of cells depending on the results of the called macros.
6. Reactivates protection.
As well as the cells the called macro changes, there is a column of True/False results stretching from AE16 to AE491 with several blanks in the list as well. (All of this is decided upon a different macro that isn't linked with the change.) I want a loop that will read the True/False column and if it finds a false, make 8 buttons invisible.
I tried putting this code between Step 5 and 6 of the macro.
Code:
Dim J As Integer
J = 16
Do
[Code].....
This isn't working at all... I was thinking if there was gonna be an issue then it would be the opposite where it stops the buttons appearing all together but even when there are falses and I am changing things it doesn't seem to make a difference.
View 3 Replies
View Related
Jun 8, 2007
Column C contains the names of real-estate brokers.
Column E contains the colors of the homes for sale.
Column Q contains the values of the homes.
I want to return the sum of the 50 most expensive homes that are yellow and for sale by Century 21.
I'm familiar with array formulas, and with the large function. I just do not know how to incorporate the large function within the sum/array formula.
View 9 Replies
View Related
Oct 10, 2008
I'm just getting into functions, so please bear with me on this as I start to understand how they really work. I do have the VBA and Macros for MS Excel book which has been a great help!
Normally on this I would use a simple array formula to gather a total calculation from a timesheet, but in this case there can be numerous timesheets to add this up.
Hours would be recorded on a sheet with both a client and a task selected. I also have a summary sheet to show clients against tasks... adding all the hours from each timesheet.
If it were from a single Timesheet (possibly creating a single one of these for all sheets is an option?) I would be able to use the following array formula:
=SUM(IF((Timesheet1!$F$8:$F$22=C$5)*(Timesheet1!$G$8:$G$22=$A9),Timesheet1!$D$8:$D$22))
Timesheet1 Column D = hours
Timesheet1 Column F = clients
Timesheet1 Column G = tasks
Row 5 (starting Column C) = clients in summary sheet (across top)
Column A (starting Row 9) = tasks in summary sheet (down side)...........
View 9 Replies
View Related
Feb 27, 2007
I am trying to write a public function that fills a table for a 2-dimensional array and am having trouble with my named ranges. The x-axis is based on years (range F2:O2) and the y-axis is a q_factor (range E3:E23) so the data range would be (F3:O23. The following outlines my logic:
Public Function bondValue(years As Range, q_factor As Range, z As Double)
Dim nRow As Long, nCol As Long
Dim bondPort As Range
nRow = q_factor.Rows.Count
nCol = years.Columns.Count
sumTau = 0
View 6 Replies
View Related
Jan 15, 2008
I have written the code below. But it didn't work. In my opinion the error is most probably caused by irr worksheet function. Because the code is actually bigger and I tried it all part by part.
Option Base 1
Dim i As Integer
Dim j As Integer
Dim counter As Integer
Sub General() 'Makes general calculations
Dim Cash_Flow_Project_Entity(49) As Variant 'Toplam Yatırım Nakit Akımı
Dim FIRR(49) As Variant 'Yearly FIRR
Analysis_Period = Worksheets("Veri"). Cells(15, 5) 'Takes " analysis period" from "Veri" Worksheet
End Sub
View 9 Replies
View Related
Jun 20, 2008
I have the following assignment to do, problem is I'm new to arrays and functions in VBA and nothing is working for me, i get errors no matter what i try, (for example i don't know how to feed the array to the function, and it won't let me write a range to an array)
5.A) Write a function that takes a 2D array of doubles, a single cell range, an optional cap and an optional floor.
B)Write the array on to the sheet with the single cell range parameter being the location of the top left of the array on the sheet. When writing the array to the sheet, for each value in the array where it is below the floor put the floor on the sheet, where the value is above the cap put the cap value on the sheet, otherwise display the original value. The input array should not be modified.
All code should be what you consider production quality.
Dim topleft As Range
array1 = Range("B8:C18").Value
'array1(1, 1) = 2
'array1(2, 1) = 3
'array1(1, 2) = 6
'array1(1, 3) = 9
'array1(2, 2) = 4
'array1(2, 3) = 5
View 9 Replies
View Related
Jan 25, 2013
How can I obtain the array values from a function?
For example: Those steps were made by cytop to split a text (btw it works perfecet!!), I just added Function splitText(strSplit As Variant) As Variant ... End Function
VB:
Function splitText(strSplit As Variant) As Variant
Dim datosColumnaIncio() As Variant
Dim iTemp As Integer
Redim datosColumnaIncio(Len(strSplit) - 1)
For iTemp = 1 To Len(strSplit)
datosColumnaIncio(iTemp - 1) = Mid$(strSplit, iTemp, 1)
Next
End Function
So I want to know if its correct like that:
VB:
Function splitText(strSplit As Variant) As Variant
Dim datosColumnaIncio() As Variant
Dim iTemp As Integer
[Code] .....
So when I call the function:
VB : MsgBox splitText("F4")
It throws an error message :s what is wrong or how can I get the array values of a function ???
View 2 Replies
View Related
May 12, 2014
I am trying to subtract two values, which are calculated from arrays. Here is my actual code:
[Code] ......
If I remove the "-", I get the sum of both arrays as expected. If I include the "-", I get the "#VALUE!" error message.
View 4 Replies
View Related
Apr 22, 2009
Does anyone know why you can't specify an array, like an array of Doubles, as an argument or input to a custom function? For example:
View 14 Replies
View Related
Aug 7, 2009
Ok, I'm sure that there is something really obvious here, but I'm just not seeing it....
Test Data starting at cell A1:
View 14 Replies
View Related
Dec 9, 2009
Please see the attached worksheet for details. I would like the array function to search for instances of the word "FALSE" in column E and return the values of columns A:D when a match is found. I have done this successfully when the lookup value is a value in the first column of the range, but cannot seem to do so when the lookup value is in the last column of the range. I have received a #NUM! error each time.
View 9 Replies
View Related
Oct 4, 2011
I have an array called "Universe", which have duplicated values. I am trying to write a code that gives me an array which have only unique values.
View 9 Replies
View Related
Nov 15, 2011
I have 15 toggle buttons that are each tied to a unique value. A toggle button identifies the value as either Active or Inactive. I then want to add a command button that will produce the product of all the Active toggle button values.
For very few togglebuttons I can use a code similar to the following (adjusting for the number of buttons)
Code:
Private Sub CommandButton1_Click()
If ToggleButton1.Value = False Then
Sheets ("CTG Calc").Range("e50 = Sheets("CTG Calc").Range("E47") * Sheets("CTG Calc").Range("E48)
Else
Sheets("CTG Calc").Range("E50) = Sheets("CTG Calc").Range("E47")
End If
End Sub
However, when I get more than just a couple togglebuttons it becomes very unwieldy to have multple If then statments for a True/False option for all 15 buttons. I know there is an easier way to do this with some kind of array function that will look at each toggle button separately anf if the togglebutton value is false will generate the product of all false togglebuttons and ignore the value of all true toggle buttons.
View 6 Replies
View Related
Jun 21, 2013
Any way with standard excel array functions to achieve a mirroring of a vector? I would like to use it in further calculations, thus a cell-by-cell OFFSET(.) solution unfortunately does not work for me.
So what i need is basically that
a
b
c
becomes
c
b
a
(thus being projected by a matrix
0
0
1
0
1
0
1
0
0
)
as an array function.
View 3 Replies
View Related
Aug 5, 2013
I have a grid like follows (how to format):
2013-08-16-5.00 0 0
2013-08-16-2.0-19,902 -20,734 -21,429
2013-08-16-1.011,431 11,907 12,297
2013-08-160.0-0 0 -11
2013-08-161.0111 153 140
2013-08-162.031 61 60
[Code]...
Basically I want to return an array (to pass to another function) containing all data that matches my search. E.g. I want to retrieve an array of the data that matches 2013-09-20. Is the only way to do this a VBA func?
View 5 Replies
View Related