Getting The Second Highest Value From An Array

May 23, 2007

Is there a way to get the second highest value from an array in vba?

View 9 Replies


Excel 2007 :: Finding Next Highest Value In Array

Sep 12, 2010

I am using VLOOKUP with the not_exact_match set to True, however instead of finding the next largest value that is less than value, I want to find a way of returning the next largest value that is greater than value. I have looked at using MATCH and OFFSET to try and increment the returned value by 1.

View 9 Replies View Related

Dynamic Range - Array Formula That Provide Highest Values

Jun 22, 2012

I've am array formula that I use to provide highest values:


{=INDEX(Data!$D$2:$D$128, MIN(IF(LARGE(Data!$D$2:$D$128,ROW(A1))
=Data!$D$2:$D$128, ROW(Data!$D$2:$D$128)-MIN(ROW(Data!$D$2:$D$128))+1)),
MATCH(LARGE(Data!$D$2:$D$128,ROW(A1)), INDEX(Data!$D$2:$D$128,
MIN(IF(LARGE(Data!$D$2:$D$128,ROW(A1))=Data!$D$2:$D$128, ROW(Data!$D$2:$D$128)-
MIN(ROW(Data!$D$2:$D$128))+1)), , 1), 0), 1)}

I want to replace the range Data!$D$2:$D$128 with a dynamic reference: like that one:


The two formulas work well in separate sheets but crash when put together, how could I possibly insert the second address formula into the first one?

View 2 Replies View Related

Return Highest Value Of Column Headings With Matching Text In Array?

Mar 7, 2013

I have an array of data with multiple codes stored in text...

I want to set a formula in a cell to look for all instances of specific text in an array. Then compare the value of all of the column headings, which are numbered across the top of the array, which contain a match in that column and return the highest value.

Example: 10x10 array, columns 1,3, and 5 contain "text" somewhere in those columns. Formula would return 5.

View 2 Replies View Related

VBA Extract Highest And Second Highest Values

Nov 27, 2013

I'm attempting to put together a script which in simple terms finds the 'Highest and Second' highest activity and associated FTE for a given sub group.

To be more specific:

On the "Slide 1" sheet look at the values in column J starting at row 7 until blank;For each value, then search the "All Monthly Direct Activities" sheet in column C for the same value, excluding the 'Subtotal' rows;Where a match is found, compare all the values in column E for that sub group;And Find the highest and second highest figure;

Once these are found copy this figure and associated value in column B and paste onto the "slide 1" sheet.

I'm not particularly well versed in writing VB, but I've been working with the code to see if I can get this work, which I have been unable to do.

I have attached a file which may perhaps provide a greater detail than my description of the problem containing the 'Source' and 'Destination' sheets.

View 9 Replies View Related

Quick Max :: Possible To Show The Next Highest Rather Than The Highest

Jan 15, 2008

If I use =MAX(A1:G1) I get the highest value. Is it possible to show the next highest rather than the highest and if so how?

View 9 Replies View Related

Treating String As Array And Correct Array Format For Unicode Characters?

Jul 30, 2012

in C a string is nothing more than an Array of characters ending with a null character.

in VBA this does not seem to be the case.I am trying to use the BlowFish code from David Midkiff for some encryption, however the code sometimes fails:

When encrypting a string a string of a specific length should be returned. however sometimes one of the characters of the encrypted string is a null character, and the returned encrypted string (with a embedded null character) is causing me problems. I want to check for the null character and if present redo the encryption. But how do I check for the presence of this null character in a unicode (double-byte) string?

Checking with Len(encrypted) gives the correct length (!) but trying to move each (unicode)character into an array fails when using the Mid() function past the null character in the string.

Now I can use

byteArray() = StrConv(unicodetext,vbFromUnicode)

to get the lower byte of each character into an array easily, but how do I do this for both bytes of the unicode characters?

Using an integer array does not work other than through

intArray(j) = CInt(AscW(Mid(Outp, j, 1)))

which fails on the nullstring in my encrypted text.

I have tried with variants but so far no luck. I thought if the string was entered into a variant then I could also address the variant as an array of bytes, but that does not seem to be accepted by VBA.

View 1 Replies View Related

Populate Multiple Array Variables With Same Code By Dynamically Changing Array Name

Sep 9, 2012

I am trying to populate many arrays with the same code using something like this. For this test, assume the following data in A1.






Sub populate()
Dim firstArr(5), secondArr(5), thirdArr(5), fourthArr(5), fifthArr(5) As Integer
Dim r, c, num As Integer


The above code does not work of course and falls over. I am unsure whether I should try and concatenate with something like this eg "" & arrName(i) = Cells (r,c) or go down a different route.

View 6 Replies View Related

Search Substring Of Array Matching List Of String From Another Array?

Dec 20, 2013

I need to export this to Xcelsius which doesn't support any macros/vba. Btw I can;'t use Row() in xcelsius too.


View 4 Replies View Related

String Array Values To Array Of User-Defined Types

Oct 2, 2008

I have a class module with several private variables, including one that is an array of a user-defined type. I am trying to set the values of a single element of this array with "Property Let ..." from a string array:

View 4 Replies View Related

Converting 3x10 Array To A 1X30 Array To Run A Match Formula

Apr 7, 2009

Say I have 3 columns of data: A1:C10 and I want to run a Match() function on them all together to see if I get a match any one those cells, say the value of have in X1.

Since, Match only allows a One-Column lookup array.. is there a way to "concatenate" or "append" the 3 columns together within a formula so now I would be looking to Match in an array that is 1 column * 30 rows?

Basically want to convert =Match(X1,A1:C10,0) to =Match(X1,A1:A30,0) without moving around the raw data in the sheet.

And I want to avoid doing an AND or OR formula that uses 3 separate MATCH() for each column.

I have a hunch that the MMULT or MMULT/TRANSPOSE functions are involved, but can't seem to get it right.

View 6 Replies View Related

VBA To Output From Array Based On Variable In One Element Of Array

May 2, 2013

I'm only starting to get to grips with arrays. I have what I consider to be a lot of data that I need to 'cut' into separate workbooks. I have written some code that does this by simply looping through each line, 250k+, checking against a variable and copying the row into a separate sheet. This took longer than it would have doing it manually. It was suggested to me that I use arrays to speed up the process. I have managed to store the test data into an array but am struggling to find a way to loop through and pull out an entire 'row' from the array based on a variable. I have looked for 2 days in various places to find some way to loop through the data held in the array, but to no avail.

That code will appear here from about 8am GMT tomorrow. I know that once I've cracked this I'm on the road to some very significant time saving and comprehensive report writing.

View 9 Replies View Related

Passing Array To OFFSET - Array Height Parameter

Aug 5, 2014

I want to pass an array to Offset in the "Height" parameter, without having to type the array.


I can't seem to figure out how to build the {1,2,3,4,5}. I've tried another ROW(1:5) and have tried nesting that like N(ROW(1:5)) but nothing works.

How I can get the {1,2,3,4,5} without having to type it out (so that I can expand this to a larger list)??

View 8 Replies View Related

Filter An Array (the Longer One) Using The Shorter Array As The Criteria

Aug 26, 2009

I am trying to filter an array (the longer one) using the shorter array as the criteria. I am currently doing this using the following method

IF(LOOKUP(lookup cell, array)=lookupcell, lookupcell, "FALSE")

I then copy and paste 'values' and filter out the 'false' to get my final result.

This has worked in the past, but for some reason that I simply can't figure out, the formula isnt working! I've attached the example, and I've highlighted a number in blue (cell E522 and C103), (that should be being found in the 'LOOKUP' function) but is returning a "FALSE". I have looked over the code and simply can't figure out why Excel isn't returning the right value.

This is obviously happening for a quite a few of my numbers, as my filter result is returning an array that is about 1500 shorter than it should be. I have highlighted E522 as the 'example cell' to look at.

View 6 Replies View Related

Getting Value From Next-highest 'header' Row

Jan 28, 2009

I have a worksheet that contains a number of rows. [Thank you, Captain Obvious!] These rows are logically grouped to represent a series of "items", with each item having one or more rows (with a "header" row at the top). The rows for a particular item represent different types of information about that item, and therefore make use of different formulas based on the row type. Due to the relative complexity of the formulas in these rows, I am creating a series of row "templates" from which I can copy and paste every time I want to create a new item or add rows to an item. As such, I am trying to avoid direct cell references to different rows, as these would easily get messed up during cut and paste. Instead, I am trying to limit myself to various lookup functions (e.g. OFFSET, MATCH, etc...) that will work regardless of where a row is added.

In order to accomplish this I am using a "key" column to group all rows for a particular item together. Until now I have had to type in the key value for every row for a particular item. What I would like to do is to only have to type the key value in the header row, and have a formula populate the key value in all subsequent rows ... until a new header row is reached, at which point the new key value will be used. Take a look at the following example: ....

View 14 Replies View Related

Highest And Lowest Value

Aug 4, 2009

I'd like to record the highest / lowest value in a single cell without it being written over i.e record the highest value and if there is another value lower it wont overwrite it.

I've tried using the =max or =min but whenever a newer value appears in the cell it just follows that without keeping the higher value?

View 12 Replies View Related

Highest Permutation Value

May 5, 2007

This is for an online sports management game I play. Basically I have calculated each players skills in each position, and I need to find the best combination of the players on the field to give me the best team.

I have a table as below, and I need to find a solution that gives me what the best combination will be....

View 9 Replies View Related

Lookup Next Highest Value

Dec 2, 2008

I have an excel work book that has distances in column A from A2:A10 like so:


I would like to compare the value inputed into cell C2 against the distances and return the exact match or next highest distance to D2 if there is no exact match.

i.e. If 1340 is put in Cell C2 I would like excel to return 1400 to cell D2 as 1400 is next highest distance from 1340.

Here is the kicker, the distances cannot be sorted and I would prefer not to use VBA but I will if i have to.

View 9 Replies View Related

Highest Letter In A Row

Jan 7, 2010

I'm trying to list the latest revision of a drawing in an issue sheet spreadsheet. What I need is to be able to enter a formula that will find the highest alphanumerical value in the columns beyond. Alphabetic characters take precedence over numerical - i.e., drawing issue numbers usually follow a 00, 01, 02, 03, then switch to A, B, C, D,... order.

To try and illustrate what I mean a little better, I have the following table, with dates in DD/MM format. Sorry it's not laid out too well, my HTML isn't great:

Drawing title latest revision 01/01 02/01 03/01 04/01 05/01 06/01

I want the cells in the "latest revision" column to report the highest value. So, I want it to say this:

Drawing title latest revision 01/01 02/01 03/01 04/01 05/01 06/01

I won't have control over the numbers and letters reached (i.e., the drawing revision could get up to Z or something - or the number revision reach 15 before switching to alphabetic revisions) so I'd rather avoid having to set up a crazy IF function with "00", "01", "02", "03", "04", etc etc. But -

View 9 Replies View Related

Highest Time

Jan 13, 2010

I have 2 columns of times (military) I need to highlite the highest time. Can this be
done with conditional formatting and how can I do that?

View 9 Replies View Related

Retaining Highest Value

May 14, 2006

I am starting to use formulas and I am constantly amazed at the power of Excel. I am trying to write a spreadsheet and I'm having a problem getting Excel to do what I want; I have 2 column, each cell in Column 1 will have a numeric value changed daily. I want Column 2 to retain the highest value that has been added. i.e. If I type 4 in A1,(for example), on Monday, then B2 will read 4, if I type 5 in A1 the next day, then B2 will change to 5, but if I type a value less than 5 in A1, then I still want B2 to read 5. The value will be input daily for an indefinite period and needs to be user friendly. I can't work out how to achieve this.

View 5 Replies View Related

Look Up Highest Scores

May 9, 2007

What is the best way to look up and return the 10 best performers out of a list of say, 40. I have columns representing people's names, their school's name, their age and their total score. The following formula is to add up the 4 highest scores for each school: SUM(LARGE(($A$2:$A$499=Y2)*($C$2:$C$499),{1,2,3,4})) (entered as an array) Now I want to display the 10 best performing schools (who will be determined by calculating their 4 best scores).

View 4 Replies View Related

Find Highest Value For Each Day

Dec 24, 2007

I have a massive amount of data made up of values taken every five minutes over several months. I want to find the highest value in a day for every day. I'm wondering if the best method is to define each day as a dynamic range and then use the max value command to get the highest value?

View 6 Replies View Related

Convert Boolean Array To Integer Array?

Jun 21, 2014

wondering is there a VBA equivalent of --() in excel that turns trues and falses to 1's and 0's?

View 14 Replies View Related

Index Match Array New Formula Not Array?

Nov 6, 2013

Is there anyway to recreate this formula w/o it being an array ?

{=IF(C3="","",IFERROR(INDEX('Master List'!$B$1:$B$2000,MATCH(TRUE,ISNUMBER(SEARCH('Master List'!$A$1:$A$2000,C3)),0)),"ADD TO MASTER"))}

View 5 Replies View Related

First Array Remain Same,second Array Always 11 Cell Added

Nov 15, 2007

=CORREL(C1:C10,C12:C21) at H1
=CORREL(C1:C10,C23:C32) at H2
=CORREL(C1:C10,C34:C43) at H3

can i have a macro that first array remain the same, and second array always 11 cells added. drag it down also can

View 9 Replies View Related

Multiply Each Element In A 6x6 Array By A Similar 6x6 Array

Mar 22, 2007

I've tried to multiply each element in a 6x6 array by a similar 6x6 array, both on the same sheet, and it worked.(see Macro2 and attached xls file "Test").Then I got more ambitious and tried to do the multiplication from a standard array in sheet "TestA", with the result on the same sheet, by each array in sheet "TestB" and failed.How do I solve this problem? Pgualb PS:I'm using the R1C1 style.

Sub Macro2()
For y = 29 To 34
For x = 2 To 7
Cells(x, y) = Cells(x, y - 27) * Cells(x, y - 18)
Next x
Next y
End Sub
Sub Teste12()
'Multiplica matriz em TestB por matriz padrão em TestA com _
'resultado na matriz em TestA correspondente à matriz em TestB
Dim x, y As Integer
For y = 2 To 7.............

View 7 Replies View Related

Return Highest Value From Within Group

Jan 31, 2014

I have a data table in which the values are reported daily. I have created a pivot table using this data and grouped the dates in to week long blocks.

What I require is for the group value to return the highest values found within the 7 day period, this would link with the grand total column.

________A B C D E Total
01/01/14 1 1 1 1 1 5
02/01/14 1 1 1 1 1 5
03/01/14 1 2 2 2 1 8
04/01/14 1 1 1 1 1 5
05/01/14 1 1 1 1 1 5
06/01/14 1 1 1 1 1 5
07/01/14 1 1 1 1 1 5

In this example when grouped by week i would get the result:
__________________ A B C D E Total
01/01/14 - 07/01/14 1 2 2 2 1 8

I have also attached a sample spreadsheet.

View 2 Replies View Related

Return Value With Highest Frequency

Apr 9, 2014

I need a formula that can lookup the sell price with the highest frequency. For example, I need to look up item 2100 in sheet2 and sheet1 contain data for vlookup like this:

ID No_Frequency Sell Price
2100 4 2.99
2100 5 3.49
2100 1 1.99

I need to be able to look up and return the sell price of 3.49 since it has the highest frequency.

View 4 Replies View Related

Return Column Of Second Highest Value In Row Where It Is Same As Max Value

Jun 13, 2014

I have a row of numbers (per example below) and I would like to return the column header for the max value and the second highest value, even when the second highest value is the same as the max value.

For example

A B C D E Highest Second Highest
1 2 3 2 3 C E
3 1 3 2 2 A C

The return values are under the highest and second highest column headers?

View 5 Replies View Related

Copyrights 2005-15, All rights reserved