Search Dynamic Columns With Criteria
May 12, 2014
Trying to create a dynamic vba code that searches the second last active column for a particular criteria. In this case it is the value "901".
If the criteria is met it will search the row to see if value is >=0 then change to zero where applicable.
In the example, I have a loop which searches Column 6 for the matching criteria. I want to change from Column 6 to "second last column" which is Dynamic to allow for more column to search through.
The two codes below search through column "A" and Column "B". Is there anyway to make this Dynamic also so it searches from Column "A" to the 4th Last Active Column.
So the Column to check for Matching Criteria is "Second Last Column" The Data to Loop through will be from Column A to the "Fourth Last Active Column".
Public Sub ChangeCellValue_TwoConditions_ColA()
Dim Last_Row As Long
Dim iLoop As Long
Last_Row = ActiveSheet.Range("A65536").End(xlUp).Row + 1
For iLoop = Last_Row To 1 Step -1
If (trim(ActiveSheet.Cells(iLoop, 1).Value) >= 0) And (trim(ActiveSheet.Cells(iLoop, 6).Value) = "901") Then
ActiveSheet.Cells(iLoop, 1).Value = "0"
[code].....
View 3 Replies
ADVERTISEMENT
Feb 19, 2013
I have a 6000+ row database with 5 columns across. The 5 columns have the following headings: Hair Color, Eye Color, Age, Location, and Salary.
I have created macros that will filter each column based on criteria - for example:
[Code].....
As you can see, at cell J10 and K10, I list the filter that is used for a particular search. Some searches, will only have 2 search criteria, some may have all 5, etc.
On a separate worksheet (in the workbook), I have a "Report Tab", my question (after a long build up) is how do I dynamically change the columns and values on the "Report" tab depending on the search that I perform? For example, if I did a two variable filter (Hair and Salary), those would be the only two columns on the report - if I did all five variables for the search, all columns would be on the report, and so on.
View 1 Replies
View Related
Apr 9, 2008
I am looking to write a search function that searches through a whole document. The only examples I can find are of a could different search functions but they all are searching an specified individual column and even then I didn't really understand them. My worksheet has 6 different columns which are all different labels for a certain tool. I want the user to be able to input any of those 6 labels and have all the information in that row be returned.
View 4 Replies
View Related
Sep 27, 2011
Rep Name is Column J Row 5. I need to find multiple columns based by the header which is row 5, if column range (j5:az5) is "Video - Actual" then copy column to sheet "Data", this needs to be repeated for about 8 more times for different criteria
Rep NameBundle - TargetBundle - ActualVideo - TargetVideo - ActualJoe, Jane
2.06.06.04.0Smith, John
7.010.02.06.0Tucker, Chris
19.039.05.017.0Sandler, Adam
15.011.06.010.0Iglesias, Gabriel
8.03.06.010.5Smith, Will
8.03.06.06.5Powers, Austin
10.025.07.09.0
View 1 Replies
View Related
Nov 2, 2009
I have a workbook with many many sheets in it. The first sheet contains a single column with about 10,000 different values. I'd like to use each of these as search criteria against ALL data in the other sheets (of which there are a good 50 or so). If matches are found (they don't have to be exact case), then I'd like two things to happen:
1. The rows containing the matched search criteria in the first sheet are highlighted.
2. In the cells adjacent to the search criteria in the first sheet, hyperlinks to the matched data are created and named after the sheet upon which this matched data appears.
I've attached a sample file to this post with ideal sample 'answers' to queries made of the first 2 terms.
View 3 Replies
View Related
May 16, 2014
I have an 'Update' Module that search the value of the Userform1.txt_sc.Value in Column B, but I want to search to 2 criteria, how can i amend the below code to search for 2 criteria ( userform1.txt_sc.value & userform1.txt_linenum.value )
View 2 Replies
View Related
Mar 28, 2014
I am trying to write a macro but I got a little stuck. Basically on row 6 I have the months listed out (so like Jan Feb Mar etc), and i would like my macro to dynamically search the the cell of current month and select it.
I know the cell formula for current month (ie. "Mar") is =TEXT(TODAY(),"MMM"), but is there a way to incorporate it into a search command in macro, or do I have to insert the formula into another cell and ask the search function to search for the text value in such "dummy cell"?
Another thing to note is, I do have more of "Mar"s scattered around the sheet, but if I limit my search area to row 6 there is only one, and that's the one I need to select.
View 2 Replies
View Related
Apr 17, 2013
I have a workbook that has worksheeets for every day of the month. The data in the worksheet consists of columns (employee #, name, clock in/out times, and break penalty).
What I am trying to do is create another worksheet that searches all the other worksheets for a "yes" in the "break penalty" column and then create a list of all the employees that received a break penalty for the entire month. I would like this to be able to auto populate throughout the month as data is entered and not have to use a filter every time I want to compile this list.
View 3 Replies
View Related
Mar 25, 2014
Find button in Spreadsheet. My problem is I wish to only search 2 of the columns on my sheet.
I have been trying to locate info on my own, see here: [URL]
But I cannot seem to find anything showing how to specify where to search.
Here is the code I am using
[Code] ......
Want to search columns G and J -OR- Search entire sheet but ignore Columns A and B ...
View 2 Replies
View Related
Mar 26, 2009
Right to the point. I got two sheets in my file, one named "Order" and one named "Input". In the input sheet there is costs & revenues divided into several different divisions/activities. In column A I got the name of the cost/revenue and then the value for every period Jan-Dec in columns B-K. And the name of the activity is in column A under the cost/revenus for that activity, like a " SUM" row.
Now, in the the "order" sheet, you can select a specific activity from a rolllist and then I want that activity's revenues & cost to be shown. I've attached the file to make it easier for you guys to understand my needs. I think I need some sort of 2 criteria VLOOKUP, that is first search för the correct division, once this is found search for the different costs & revenues and the return a value. But I'm not so good at this so I can't get it to work. Maybe the INDEX function is good here but I don't get that at all. I tried Daves "2 criteria Vlookup" but all I get is #ERROR.
View 4 Replies
View Related
Mar 3, 2014
I'm looking for a way to write this:
[Code].....
as this :
[Code] .....
Where the criteria runs across a range (G to BG) that can sometimes have columns deleted, but the range must remain fixed.
View 3 Replies
View Related
Dec 11, 2007
I have a sum part of which is $I$4:$I$500.
The 500 part of the sum is constantly being manually changed using edit replace because of a growing amount of data.
In cell A1 ona another worksheet within the workbook I use the Count function to count the number of rows containing data. This cell is named DataCols
Is it possible to combine $I$ with the named Range DataCols?
I have got this far - ="$I$"&INDIRECT("ColNo") which returns 500 if I remove "&I$"& in front of it.
View 6 Replies
View Related
Jan 14, 2013
I have some raw data, and in that data are 2 columns. They are Manager and Role. I am trying to create 2 lists, that correspond to their role. I can create a dynamic named range from the column no problem using this formula:
Formula:
[Code] .....
Now, what I need to be able to do is, add a criteria option to the formula. So build the list off of column B, but only if their role (in column C) is Perm, or Temp.
See the attached spreadsheet : dynamic range criteria.xlsx‎
View 8 Replies
View Related
Dec 21, 2011
I am getting an error i have list (sheet4) i want to lookup the data from different table (Name range) based on the location in column A i am using the small function copy down, in cell C6 i want the range ROWS($A$2:B6) go back to ROWS($A$2:B2) since the criteria in column A has changed from China (A5) to US (A6)
Sheet4ABC1Locationproductsamount2ChinaA2954.63ChinaB1565.284ChinaC3772.055ChinaD2027.76US#REF!#REF!
Array FormulasCellFormulaB2 =INDEX(INDIRECT(A2),SMALL(ROW(INDIRECT("2:10"))-ROW($A$2)+2,ROWS($A$2:A2)),1)C2 =INDEX(INDIRECT(A2),SMALL(ROW(INDIRECT("2:10"))-ROW($A$2)+2,ROWS($A$2:B2)),2)B3
[Code].....
View 1 Replies
View Related
Jul 22, 2014
I am looking to write a formula that can concatenate cell A$1$ (absolute) & B1: B245 (dynamic)and then A$2$- B1:B245 and then so on.
So for example, I need to concatenate cell A$1$ & B1, and then A$1$ & B2, all the way up until B245, and then I need to restart the sequence with A2 and B1.
Formula to preform this concatenation, or will this need to be done with VBA?
View 1 Replies
View Related
Dec 4, 2008
I bring in data with these same columns A thru J. I do not know how many rows will be comming in. I have create a macro that uses the advanced filter. I have a criteria range set up on sheet 2 with 6 variables, the main data is on sheet 1. This works fine if I use all 6 variables. I wish I could select from a list box which of the 6 or all variables I need(I might select 2,3 or more variables), & have that information populate the criteria range. I only filter in place(no copying), there is only filtering on column B, the label for the criteria range will always be "Name" it will be located on sheet 2 D:1. Is this possible or should I be trying some other function? Here is the macro that uses all 6 criteria. I have searched and could not find what I was looking for.
'add criteria range
Sheets("Sheet2").Select
Range("D1").Select
ActiveCell.FormulaR1C1 = "Name"
Range("D2").Select
ActiveCell.FormulaR1C1 = "e11*"
Range("D3").Select
ActiveCell.FormulaR1C1 = "e12*"
Range("D4").Select.........
View 9 Replies
View Related
Mar 27, 2007
attached is a spreadsheet effectively replicating a criteria box I’m using to do an advanced filter on a large amount of data (5000+ lines). The criteria can be anywhere from 1 to 7 different lines. What I’m trying to achieve is code that will look at the specified criteria box, determine how many rows of criteria actually exist, and then use that code to perform the advanced filter function on the data.
Below is the code I’ve put together so far. The problem is that this code can only determine that there are 7 total rows of criteria to use, and not the exact number of rows of criteria. For instance, say I only wanted to use 2 rows of criteria, I’m hoping the macro would only use those 2 rows instead of picking up all 7 rows.
See criteria box on spreadsheet for example. In this particular example, I’m wanting the macro to only use B49:I51 as criteria. The ideal solution would be for the macro to look at the criteria box and determine the last row used that is not filled with “1”s. Does anybody have any thoughts on ways to tweak my code to get it to achieve this?
Sub RunDynamicSelection_Click()
Dim wsSheetDS As Worksheet
Dim wsSheetRS
Set wsSheetDS = Worksheets("DataSheet")
Set wsSheetRS = Worksheets("ReportSelection")
With wsSheetDS
.AutoFilterMode = False
With wsSheetDS. Range(("A4:N4"), wsSheetDS.UsedRange.Rows(Worksheets("DataSheet") _
.UsedRange.Rows.Count)).AdvancedFilter Action:=xlFilterInPlace, CriteriaRange:= _....................
View 2 Replies
View Related
Jan 29, 2013
I've got a sheet where I've got products in one column.
The second criteria is "week #" for which the row remains consistent but the column varies e.g. "week 8" could be in cell L12 today and in L18 tomorrow.
I would like to return the value of the cell at which a particular product and week intersect. e.g. if "product a" is in B20 and "week 8" is in L18, I want the value of cell "L20" returned.
Product to determine Row #, Week to determine Column # for returning value.
If they interest multiple times, I would like to sum up the values intersecting.
Neither product nor week # is unique in the sheet.
View 5 Replies
View Related
Feb 14, 2010
I have a spreadsheet with a database search function incorporated. Whilst this works fine, I was wondering if there is a way to combine the current single query searches into one search macro. I have setup a userform called CriteriaSearch that I would like to use to search my database tab. An example search would be:
User requires someone who speaks French (5), is female, has a rank of 3, is available immediately and has notes/keywords/keyphrases of "excellent linguistic and cultural knowledge". The appropriate fields on the userform are populated accordingly. The user selects search and a macro runs to find matching records. To make things slightly easier, the criteria (Language, Gender, Rank etc) all have fixed column references.
View 2 Replies
View Related
Mar 12, 2012
I am trying to find the best way to give a result based out of two criterias. My original list is 1000+ row long, so I am expecting that my vba code will be refering to a worksheet with this list on it.
The list will look like this :
Group SubgroupName1aaaname11bbbname21cccname32cccname42dddname42dddname5
I will always have the group and subgroup available and I want to get the name.
So I would like to write a function or a macro that would look for the specific group and subgroup and return me the name.
View 9 Replies
View Related
Jan 12, 2008
I have a search macro that runs from a command button on Spread sheet Called "find". This currently takes what ever the user types in cell A1 and then searches another sheet called "data" for any instances of what ever the user entered in Cell A1. I want to have a text box on sheet "find" and use that instead of Cell A1. (To keep this posting as short as possible I wont explain why I need to do this). I cant get the syntax right to refer to the text box - can someone point me in the right direction please.
View 7 Replies
View Related
Feb 26, 2014
I am looking to search in a table (say 4 columns) corresponding to multiple criterion (one for every column except fourth) and returning the values which are numerous (from column 4). I have tried the INDEX function but it only gives me one of the many cells. I am working on a table with +20000 cells per column
View 3 Replies
View Related
Apr 29, 2009
I am trying to add up all values from the cell above the search criteria. Although sumifs does work well, it wont search the entire sheet, it only works in specified rows.
Also, the problem is that the values to be added are determined via a vlookup based off of a cell whose value is chosen by a drop down choice.
View 14 Replies
View Related
May 20, 2009
I have an Excel Sheet with three columns of data. In a separate worksheet, I am setting up some calculations. To do so, I am having the user select from a drop down list, the data in the first and second columns. Based on the two values selected by the user, I would like to bring forward the value in the third column. Can someone please help me out with the formula to do so?
View 14 Replies
View Related
Jun 21, 2013
I need a formula that will tell me what Tracking # in the spreadsheet has multiple dispositions and what those disposition are. I need the formula to use column and cell coordinates and not using word searches.
example
Tracking # Req.# Disposition
1490069 045 snakes
1015907 047 candy bars
1488026 044 chickens
1015907 047 sand paper
1015907 001 fruitcups
1490129 046 cupcakes
1484817 043 Cats and dogs
View 2 Replies
View Related
Dec 8, 2009
If I have a 'key' value in a cell in one sheet, i want to use that value to find the cell in another sheet containing the 'key' and return the row number of the cell, if more than one value then I would like to be able to loop through all the rows containing that 'key' value returning the row number of each hit, kind of a programmatic version of vlookup?
View 8 Replies
View Related
Oct 5, 2011
I want to display multiple results based on 2 search parameters, where by when I enter flight number and Dep. Airport it matches the trip numbers and dispalys all the rows matching all flight number and Dep. airport based on the unique trip number.
Notice: - one trip number could consist of multi flight sectors.
1) Explanation of the data :
MMM1805 = flight Number
935 = dep. time
$AS41 = registration code
[Code].....
View 9 Replies
View Related
Mar 4, 2012
I have data on one sheet which has many columns, but i need a formula that will show in a different sheet all cases where column C matches my search criteria but only those cases where column D has the value YES, and should return only the data from Columns A, B and E. I also need a formula that will show only the count of where my search criteria is met.
View 3 Replies
View Related
Apr 9, 2012
On my spreadsheet i want to find the results from 2 criteria that i entered.
My search criteria are "Oostbos" and "AA8", and excel has to find this from another spreadsheet that i made for rostering.
OostbosN3 evelineAA8N3 evelineAA8N2 MargaAA7
The problem is that i have multiple shifts with the "AA8" criteria, but my function only finds the first one.
I used the following function:
Code:
=IF(C8="";"";INDEX('Afdeling PG PH'!$A$6:$A$28;MATCH(C8&$A$7;'Afdeling PG PH'!$B$6:$B$20&'Afdeling PG PH'!$AI$6:$AI$20;0)))
Also when the AA8 cel is empty that i doesn't show anything.
How the second N3 eveline, shows the 2nd result and so on.
View 1 Replies
View Related
Mar 18, 2013
I created a userform for a giant spreadsheet with tons of data in it. There are three criteria. I created two command buttons - one that's "search" and one that's "close." The close works fine, but I don't know enough to program the "search" command. I'd like it to pull all data that matches the three criteria - rows H, D and M. So, if you answer all three, the macro will pull the rows of data that matches and paste it into another workbook (that opens in another window).
I'm not sure userforms are typically used for this sort of thing...
View 9 Replies
View Related