Locate Value In A *rectangular* Range, Then Give Column & Row
Feb 7, 2008
I need a formula (or formulas) to give me the "coordinates" (Column & Row location) of a certain value in a large rectangular range. Intuitively this should be doable with a smart combination of VLOOKUP, HLOOKUP, INDEX, MATCH, ADDRESS and/or CELL functions (maybe in the form of "array formulas") but I can't seem to find the way...
Here is an example of what I need:
I have a large rectangular range (A10:F500), full of numerical values. Then in cell A1 I have one of the (many) values contained in the range, let's say, 3.14159. I need two formulas that give me the following:
a) A formula in cell B1 that tells me in which COLUMN of the range the value 3.14159 is located
a) A formula in cell C1 that tells me in which ROW of the range the value 3.14159 is located
If the range consisted of a single column (or a single row), this would be an easy INDEX and MATCH combination.... but I'm dealing with a *rectangular* range here...
View 9 Replies
ADVERTISEMENT
May 16, 2012
I am new to VBA and have tried to develop the code for finding a specific stock symbol (Column A) from over 4200 symbols from a downloaded csv file, copy the data in in its (specific symbol's) row (in the next 5 columns B to F) to the 3rd blank row in the master workbook (data arranged from Bottom to Top). In the Master workbook each stock symbol has a worksheet with its symbol as the tab e.g. BHP.AX is the tab or sheetname for BHP stock in the Australian Stock Exchange. The downloaded file comes from a subscribed site EODData which provides daily OHLCV (Open/High/Low/Close/Volume) data against each symbol.
My attempt is shown below and it is very primitive. It does not work! I wish to run it from the Master workbook (name:-0PortfolioASXMultipleIB.xlsm) and not from Csv Data file.
VB:
Sub Macro0CopyFromCSV()
'Insert a blank row and format it in Master workbook
Rows("3:3").Select
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
[Code] ......
View 9 Replies
View Related
Jul 26, 2014
I'm trying to write a formula that searches for the name of the column on one sheet, finds that column on another, then results in the column letter. So, ideally, if the first three columns in the first tab were "Team," "Name," and "Total," respectively, I just want a formula to search for "Name" and give me back "B."
I want to do this in case anybody ever moves the "Name" column, for example, from column B to column C -- so then it would search for "Name" again and change the range in the formula to "C" because that's where that data lives now.
Currently, I'm using it for a COUNTIF() function that is a very simple: =countif(indirect("'"&$A2&"'!K:K"),$B2), where A2 is the sheet name. The latter half of $B2 is fine -- but I would love to have a more complicated formula take the place of the range "B:B" in case the "Name" column ever got moved.
View 8 Replies
View Related
Sep 15, 2014
is there a code to draw a circle? by supplying the center position and the diameter? for example cell "A1" and " A2" are for the center of the circle position and "A3" for the diameter? and whats the code for drawing a rectangular by supplying the starting position and short length and the long length?
View 6 Replies
View Related
Jul 12, 2006
We have an excel worksheet with textfields, that are compiled (when a btn is clicked) and the results are assigned to a static range. (Meaning, the results always appears in the same cells)
Question is: How can i have the results appear in a different row each time, starting on row 14 ?
View 4 Replies
View Related
Jul 18, 2007
I've got a formula that takes a value from the last numerical entry in a column. Is there a way to code this so that I don't have to enter the cell location of that number manually every time I append the sheet?
View 7 Replies
View Related
Mar 20, 2012
I have a worksheet (A) similar to the following:
Jan '12, Feb '12, Mar '12 --> Header Row
-5, 10, 2
6, -2, 3
5, -2, -1
I have another worksheet (B) with the same header Row (Jan '12, Feb '12, Mar '12). I need to create formula in cell A2 on worksheet B (right under Jan '12) that dynamically locates the Jan '12 column in worksheet A and then sums the numbers in that column only if they are < 0.
So in cell A2 on worksheet B (under Jan '12) I'd have -5 (only -5 is < 0), in cell B2 on worksheet B (under Feb '12) I'd have -4 (-2 + -2) and in cell C2 on worksheet B (under Mar '12) I'd have -1.
I've tried several variations of sumproduct, sumif, index, etc. with no luck.
View 3 Replies
View Related
Mar 10, 2013
I need to locate the highest number in column b then in column c minus the users score from the highest so they can see how much they are behind the highest score. eg.
A B C D
fred 150 highest
dawn 125 25 points needed
mark 100 50 points needed
kevin 80 70 points needed
View 4 Replies
View Related
Sep 14, 2007
Is there a way to reference a column depending on its header? Is there a way of doing this without the need of surveying one-by-one all the column headers with a for loop? I need this cuz if I have a very dinamic program which moves columns arround and depending on the state of the program the position of a column can change.
View 2 Replies
View Related
May 20, 2012
I need a formula that will tell me which 'BPS' a person should receive based off of the count of loans closed (between 'Criteria 2' & 'Criteria 2.1' and/or the volume (total of 'Loan Amount')(between 'Criteria 1' & 'Critera 1.1'), whichever gives the person a the higher tier.
I have provided an example below. In the example John Doe should receive .01750 'BPS' because he closed over 1 million in volume. If, for example, John Doe closed 5 loans for 400,000, then he would receive .01600, since he met the criteria for the 2nd tier based off of # of loans closed.
The formula needs to take into consideration which 'Comp Plan' the person has, as well as the other criteria mentioned above.
Bitmap BRANCHBitmap COMP PLANCOMP PLAN IDCOMP PLAN TIERCRITERIA 1CRITERIA 1.1CRITERIA 2CRITERIA 2.1BPSSACRAMENTOSAC-COMP-A11$ - $ 599,999.99 020.01250SACRAMENTOSAC-COMP-A12$ 600,000.00 $ 999,999.99 350.01500SACRAMENTOSAC-COMP-A13$ 1,000,000.00 $ 100,000,000.00 61000.01600SACRAMENTOSAC-COMP-B21$ - $ 599,999.99 020.01500SACRAMENTOSAC-COMP-B22$ 600,000.00 $ 999,999.99 350.01600
[Code] .......
View 1 Replies
View Related
Jan 18, 2013
I have the simple code below to perform and filter and copy:
Code:
Sub Macro1()
Sheets("Data Dump").Select
Range("A1:F100000").AdvancedFilter Action:=xlFilterCopy, CriteriaRange:=Range( _
"K1:L73"), CopyToRange:=Range("P1:U1"), Unique:=False
End Sub
However, the CriteriaRange can change depending on which OptionButton the user chooses on a different tab. My reference the range is in Cell N1. So how can I use Indirect to refer the range in Cell N1 instead of the current CriteriaRange of K1:L73?
View 5 Replies
View Related
Nov 2, 2012
I have a bit of code that I saved as an add-in. The code does a couple things: (1) Creates a right-click button that on action (2) draws a rectangular auto-shape that is the size of any selected range.
The add-in seems to loaded correctly.
However, when I launch a new excel sheet, my intent was to have the code (the right click option) be available whenever I opened Excel.
Is there another step to accomplish this?
View 7 Replies
View Related
Dec 2, 2008
Is there a formula I can use to locate the last active cell in a column. I did use the count function, however this isn't always reliable if there are blank cells within the column
View 5 Replies
View Related
Aug 28, 2007
I want to look at a whole colum and to tell me if the 6 digit number is located within it.
is "787897" located in column D? if so tell me by either Y / N or 1 / 0.
View 9 Replies
View Related
Jun 2, 2008
Here is the sheet where I entry new data. From left to right: Productnumber/article/supplier/price per item/starting nr of articles/order threshold/ date 1st order/date of delivery. When I press the button "verwerk" the data will be transported to the sheet "Voorraad verloop" shown underneath. As you can see the first problem consists of the placement of the first table. I can't get it to the first column. The second problem is that when I enter a new product like in the first image, it overwrites the current data in the sheet "voorraadverloop". See the image below. I used the following macro:
Private Sub CommandButtonVerwerknieuw_Click()
Dim iLC As Integer
Dim FindString As String
Dim rng As Range
Dim Lr As Long
If Application.WorksheetFunction. CountA(Range("A4:F4")) < 6 Then
MsgBox ("Niet volledig ingevuld"): Exit Sub
End If
FindString = Range("A4")
If Trim(FindString) <> "" Then
With Sheets("Voorraadscherm").Range("A29:A65536")
Set rng = . Find(What:=FindString, _
After:=.Cells(.Cells.Count), _
LookIn:=xlValues, _
lookat:=xlWhole, _ .................
View 6 Replies
View Related
Jun 10, 2008
in my workbook i have 3 sheets named "time" "final" "push". in the sheet thats named "final" ihave in cells B2 and C2 2 values that correspond to a type interval (lets say 75-378) in the sheet "time" each row represents 1 sec, starting at one.
what i would like to do is locate the interval defined by the 2 values on "final" sheet
and find the min max and value in column S of the "time" sheet.
i.e if B2 and c2 said 78 and 378 it would go on "time" sheet select the range of S78-S378 and find the mean, the max and the average and report them in sheet "final" in cells E2 F2 G2 respectively What would be optimal is that there was a way to perhaps loop so that it can do the same thing with the range defined by the values in B3 and C3.
View 14 Replies
View Related
Aug 24, 2006
Dim myDynRange As Range
Dim myLastRow As Integer
Range("H:H").Select
myLastRow = Range("H:H"). CurrentRegion.Rows.Count
myFirstCell = Cells(Counter, 8).Address
myLastCell = Cells(myLastRow, 8).Address
myDynRange = myFirstCell & myLastCell
im having a problem with the last line
myDynRange = myFirstCell & myLastCell
my eventual aim is to do an average on this column with a line like
ActiveCell.Offset(Counter, 1).Value = Application.WorksheetFunction.average(myDynRange)
the reason why my range declaration is so strage is because i was trying to change the dimensions of the range with an offset function because i had many ranges to average but the offset function didnt want to work. this way goes like this....................
View 2 Replies
View Related
May 16, 2013
I'm doing a statistics workbook there I need to add untill the given value in the cell
ex: if gave 5 in the cell we want to get the total until only to 5th cells
(M/M/S)FIFS/INF/N)
No of Server
3
l
0.20
n
Coeffient
P(n)
[code]....
We changing the value in N=5
View 7 Replies
View Related
Apr 29, 2009
I would like to write a formula to have a result in a cell that gives me the maximum value of a column, but smaller than another cell.
For example:
C1 = Maximum value in column A1:A20, but smaller than B1.
View 14 Replies
View Related
Jul 8, 2014
I have around 500 csv files, each with four columns of data. However, the first column does not have a heading. Is there any way I can give the column name to the first column in each of 500 csv files? Here is one of the csv files:
name1 name2 name3
1774.77 4.15 29.28
17810.45 6.2450.36
18257.86 16.9169.11
18326.46 20.1 18.93
1841.48 20.29 0.95
1850.84 20.45 0.79
2031.49 3.44 8.86
2040.06 3.41 -0.87
2050.02 3.37 -1.17
2060.91 3.51 4.15
20711.35 2.77 -21.08
2085.23 3.51 26.71
2090.02 3.51 0
2100 3.5 -0.28
2110.06 3.33 -4.86
21229.25 6.91 107.51
View 8 Replies
View Related
Mar 8, 2012
I am currently using the .resize function to give a specific value to each cell within a range.
First of all, is it the most efficient way to do it?
If so, why am I getting error "Application-defined or object-defined error"
with this code :
Code:
ThisWorkbook.Sheets("Merge").Range(Cells(3, 2), Cells(4000, 2)).Resize.Value = "TEST"
View 2 Replies
View Related
Sep 3, 2009
FromToTriggerrange26Stop-lossrange25Combination triggerlevelie: 4Combination stop levelie: 5Profit $10
How can I make "Solver" run a check on which combination of trigger and stoploss that gives the highest profit? The range is in two different cells, but I can't get it working. I guess that it's my lack of skills, and not "Solver" that isn't complex enough.
View 9 Replies
View Related
Jan 10, 2014
Assume you have a rectangular range. Say A1:M18. There are values in some random cells (any number of cells) within the range. The rest of cells are blank. In cell M19 (ie cell below the bottom right corner of the range), I need a excel function that returns the nearest (ie physical location) non blank cell value. I have searched the internet for weeks. The closest formula is the following (see below) but it is flawed as it returns zero if there are values in rows below the row of the nearest cell with non blank...and also zero if there is value in a column greater than the column of the nearest cell with non blank.
Closest formula so far:
INDEX(A1:M18,LARGE(IF(ISBLANK(A1:M18),"",ROW(A1:M18)),1)-ROW(A1:M18)+1,LARGE(IF(ISBLANK(A1:M18),"",COLUMN(A1:M18)),1)-COLUMN(A1:M18)+1).
And the function should be relative not absolute as the range can be extended..but the location of the formula remain same relative to the array size. (ie. always at below the right bottom cell).
NOTE: Ignore the special case where two non blank cells are the nearest. That will not happen.
View 5 Replies
View Related
Dec 12, 2012
This is a re-submission of a question previously submitted because the title for the first submission was so poorly worded.
I have a column that has numerical values in random order. I want to locate the first occurance of a value in that column.
I have unsuccessfully tried an Index-Match function - apparently unsuccessful because the values must be in ascending or descending order?
View 6 Replies
View Related
Jan 9, 2014
I need a VB Script or Excel tip to Locate the latest value in the column.
Example1
Value
1
2
3
4
5
6
Latest Value
6
Example2
Value
1
2
3
4
5
Latest Value
5
Note: I have 1 Row and 'N' Column. Column may have null value, which need to be ignore as mentioned in the example.
Also., if in future new value has been entered in the column then the Latest value has to be updated automatically with the new value.
View 6 Replies
View Related
Nov 27, 2007
When using the formula '=COLUMN()' in cell A1, it returns the number of the column - in this case, '1' (for column A). Is it possible to affect this formula so that it returns the column letter (in this case, 'A')?
View 9 Replies
View Related
Jun 30, 2009
I’m looking for a formula that will give me a figure against the name in column A (name) while looking picking out a specific word within the column B, say "alarm"
So it reads
Alan Ingram 1
David walker 3
And so on...
View 9 Replies
View Related
Jun 18, 2014
I have a list of sites and depending which site I select from my drop down box I want to retrieve that data from my full data sheet. How can I go about doing this?
View 3 Replies
View Related
Nov 8, 2013
In the attached spreadsheet I would like to locate the peak values of the numbers in column "F". I don't know if this is best done with a series of functions or by using a macro.
Column "F" translates to the light blue line on the attached chart. Column "F" (MACD) is the difference between a 12 week exponential moving average (EMA) and a 26 week EMA.
I would like the peak values from column "F" re-stated into column J,K,L or M. Ideally I would like to find the highest peak that occurred in a rolling 12 weak period. So not all peaks would need to be posted. By doing this I would only be identifying longer trends .
I'm using Excel 2007. 25 years experience using Excel and functions. Limited experience with Macros though long ago I used to write C code.
View 3 Replies
View Related
Apr 3, 2009
I am using the below code to locate the last column in various worksheets before pasting information. The problem is the column selected is either: Correct, Is a blank column with many blank columns in between it and the last visible text. The code also highlights all the cells containing text in some sheets. The results are the same for each sheet the code is run in i.e it is not varying.
View 4 Replies
View Related