Matching Data In An Array
Jan 18, 2008
In attempting to answer another post, I came up with this code to try to test whether data in columns "p" through "w" matched data in columns "a" through "h".
The problem is, it's acting as though everything is a match, and in my test sheet, I have some data that matches, and some that does not match.
It just highlites the whole range.
Here's the sample data:
******** ******************** ************************************************************************>Microsoft Excel - Book2a.xls___Running: 11.0 : OS = Windows XP (F)ile (E)dit (V)iew (I)nsert (O)ptions (T)ools (D)ata (W)indow (H)elp (A)boutA1=ABCDEFGHIJKLMNOPQRSTUVW1abcdefgh pqrstuvw2abcdefgh pqrstuvw3abcdefgh abcdefgh4abcdefgh pqrstuvw5abcdefgh pqrstuvw6abcdefgh pqrstuvw7abcdefgh abcdefgh8abcdefgh pqrstuvw9abcdefgh abcdefghSheet3 [HtmlMaker 2.42] To see the formula in the cells just click on the cells hyperlink or click the Name boxPLEASE DO NOT QUOTE THIS TABLE IMAGE ON SAME PAGE! OTHEWISE, ERROR OF JavaScript OCCUR.
And here's the
Sub deldupes()****'if data in p through w matches data in a through h, delete p through w****Dim ah()****Dim pw()****Dim arrcount As Integer****Dim cell1 As Range, cell2 As Range****Dim DataCount As Integer****Dim Counter As Integer****'change the sheet name as necessary.****With Worksheets("Sheet3")********DataCount = .Range("A" & Rows.Count).End(xlUp).Row********ReDim ah(1 To DataCount)********For Each cell1 In .Range("A1:A" & DataCount)************If IsEmpty(cell1) Then GoTo nextcell1************For Counter = 1 To 8****************x = x & .Cells(cell1.Row, Counter)************Next Counter************arrcount = arrcount + 1************ah(arrcount) = xnextcell1:********Next cell1********DataCount = .Range("P" & Rows.Count).End(xlUp).Row********For Each cell2 In .Range("P1:P" & DataCount)************If IsEmpty(cell2) Then GoTo nextcell2************For Counter = 16 To 23****************x = x & .Cells(cell2.Row, Counter)************Next Counter************On Error Resume Next************y = WorksheetFunction.Match(x, ah, 0)************If y = "" Then****************With .Range("P" & cell2.Row & ":W" & cell2.Row).Interior********************.ColorIndex = 6********************.Pattern = xlSolid****************End With************End Ifnextcell2:********Next cell2****End WithEnd Sub
I realize that:
If y = "" Then
should be:
If y "" Then
View 9 Replies
ADVERTISEMENT
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.
[Code].....
View 4 Replies
View Related
Jan 20, 2013
My task is to combine two large databases into one spreadsheet by extending the number of columns. The data from each database is 90% matching based on an identification number, however occasionally there are additional rows or unmatched identification numbers that need to be kept for analysis.
When this happens, there needs to be a blank row inserted to represent the missing data in the rest of the corresponding row.
I am having trouble finding a quick way to do this because I have approximately 12,000 rows (and columns up to DV when combined).
for example:
p1
data
data
data
data
p2
data
data
data
data
[Code] .....
needs to become:
p1
data
data
data
data
[Code] .....
I am guessing I will need a macro of sorts, So far I have made one column that tell me if the ID's are matching or not (1 or 0) and if they are not matching (0) I manually insert the rest of the row that is missing or make space for the duplicate data (which needs to remain).
View 5 Replies
View Related
Oct 3, 2009
How do you load an array with values from cells matching a criteria?
I want to look for the number 1 in row 5 and put the Adjacent values in Row 2 in an array.
So here my array should have 1,3,6
Dim CountOne As Integer
CountOne = Application.WorksheetFunction.CountIf(Worksheets("Tool Administration Form").Range("B8:AE8"), "1")
Dim All As Variant
Dim rCell As Range
Dim ArrCnt As Integer
Dim lArrVar As Long
ArrVar = 0
Do
For Each rCell In Worksheets("Tool Administration Form").Range("B8:AE8")
If rCell = 1 Then
ArrCnt = ArrCnt + 1
All = Cells(-3, 0).Value
End If
Next rCell
Loop Until ArrCnt = CountOne
I keep getting errors... I don' tknow how to fill the array properly wiht the values in the cells.
Example:
A B C D E F G
1
2 1 2 3 4 5 6 7
3
4
5 1 2 1 3 3 2 1 4
View 9 Replies
View Related
Feb 25, 2010
I have an Excel spreadsheet (XP - 2007) listing Job Nos. in the first column, with several columns of Station assignments and dates.
Both planned dates and actual dates are included, adjacent to each other. The dates are not necessarily in a straight ascending or descending order. Separate arrays exist for: Plan Nametags, Actual Nametags, Plan Dates, Actual Dates.
Example:
Job No.Sta1 PlanSta1 ActSta2 PlanSta2 ActSta3 PlanSta3 Act1A10001-Feb-101-Feb-106-Feb-106-Feb-101-Mar-101A100116-Feb-1016-Feb-1019-Feb-1022-Feb-105-Mar-101A100225-Feb-1025-Feb-102-Mar-104-Mar-1010-Mar-10@
@
I need to capture two pieces of information for each Job No. on a daily basis:
1- The 'Planned' Station for the build, based on a match of the 'Plan' date fields to a pre-populated 'Report Date'.
I've been able to do this (using INDEX-MATCH function).
2- The 'Actual' Station location for the build, based on the Maximum 'Actual' date entry in the row for each build.
(In the example above, Job# 1A1001 would have an 'Actual' location of 'Sta2 Act'...)
I need to figure out how to accomplish step (2) above. I've made several attempts with INDEX-MATCH and LOOKUP functions, without success.
View 10 Replies
View Related
Jun 13, 2007
im currently using a static array to select multiple sheets at once which works alongside another Sub
Sheets(Array("Group1", "Group2", "Group3", "Group4")).Select
i have a button that creates a new sheet and names it "GroupX" X being the next number, it automatically adds on the right number by itself and it works fine...
i want it my array to be dynamic so that i dont have to manually edit the array and the macro every time i add a new sheet.
i have tried things like:
Dim MyArray As Variant
Dim Shts As String
K = Sheets.Count - 4
For p = 1 To K
Shts = "Group" + p
Redim MyArray(K) As String
MyArray(K) = Shts
Next p
Sheets(MyArray(K)).Select
View 9 Replies
View Related
Feb 27, 2014
I have two tables, Table1 one has only customer codes in it, and I have Table2 with plenty of customer codes and those customer name, surname, age, location...
And I want to match and copy each of those customer codes in Table 1 all the information which is on Table2
Table 1:
50025
50026
50086
Table 2: Considering that name, age and location is each in separate cell
50025JohnSecond25Location 1
60085EmilyThird 20Location 2
45454Wilhelm Fourth35Location 3
10000RoseFifth 60Location 4
50086JohnySixth 45Location 5
65501JacobSeventh18Location 6
50026Jackie Eighth22Location 7
And the outcame should be that it finds the value from Table1 in Table2 and copy's information in Table 1 like this:
50025 JohnSecond25Location 1
50026 Jackie Eighth22Location 7
50086 Johny Sixth 45Location 5
View 2 Replies
View Related
Feb 20, 2014
I have two worksheet "ABX" and "ACX" from which I want to find the matching data for specific columns B, D and E only.
Matching data will be in sheet "Match" and vice versa.
Data are present dynamically.
View 1 Replies
View Related
Jan 14, 2009
I would like to have a formula in one cell that finds records on another sheet that meet certain criteria, and produces a sum of the total quantities associated with that record. The attached workbook has more details as to what I am trying to do.
View 2 Replies
View Related
May 9, 2014
I'm having a difficult time returning COUNTIF values for a positive match between 2 columns THAT meet a certain condition. Basically I want to iterate through column A sheet 1 (ONLY for values where column B is paid) and return a count for every instance there is a match of value A sheet 1 in column A sheet 2. In other words, I'm looking to find the number of ids marked as paid from Column A sheet 1 that exist in Column A sheet 2. I don't wish to return the actual ids, just the total count.
I've tried the following but I know there's an error in iterating through Column A the way I have it:
=COUNTIFS(Sheet1!$ColA:$ColA,Sheet2!$ColA:$ColA,Sheet1!$ColB:$ColB,"paid")
Sheet1:
ColA
ColB
123
paid
[Code] .....
Sheet2:
ColA
ColB
23
NY
[Code] .....
View 7 Replies
View Related
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
Jul 9, 2012
want to match column A to column C and if they match take whats in column D and put it in column B.
Column C has multiple instances of Column A and I would like each instance's, which is the following column, value put into column b
View 2 Replies
View Related
Jun 7, 2014
I am trying to use a nested INDEX and MATCH array formula to return the value in column C when matching column A and column B, but with a few more criteria.
The range containing all the data
A
B
C
1
Cat 1
January 1, 2014
John
[Code] ..........
I am looking for the array formula to return the name of the person in column C who is in Cat 1 after the date in column B.
For example;
C7 should return "John" because B7 requests "January 15, 2014", which is after the value in B1
C8 should return "John" because B8 requests "February 15, 2014", which is after the value in B1
C9 should return "Andrew" because B9 requests "August 15, 2014", which is after the value in B4
The best try I had for the formula in C7 was
{(INDEX($A$1:$C$4,MATCH(1,($B$1:$B$4>=B7)*(A$1:$A$4=A7),0),3))}
This brings back "John" as desired in C7, but when copying down the table into C8 and C9 both C8 and C9 return Andrew.
I guess this is due to my ">=" condition in the Match formula and it is returning "Andrew" because "Andrew" is also after the date requested, but I cannot for the life of me work out how to get it to work.
View 2 Replies
View Related
Aug 3, 2006
i have a very large spreadsheet filled with telephone numberS and some other codes that go with them...i need to match the codes with the phone numbers.
Sub TRCO()
Dim TNs As Long
Dim i As Long
Dim TempArray() As String
Dim TRCO As String
Dim CD03 As String
Dim ASOC As Range
TRCO = "TRCO"
CD03 = "CD034DF1"
'Filter TN's
Columns("B:B").EntireColumn.Insert
Set tempRange = Range("A6", Range("A65000").End(xlUp))
With tempRange
. AdvancedFilter _...................
View 2 Replies
View Related
Jul 11, 2007
On one sheet (KPI) I have either the values "x" or "" in the range A84:A89 to mark wheter to use the corresponding project in the range B84:B89. On the sheet X-ref I have the same project names in range T4:Y4 and a corresponding target value in T8:Y8
What I want is the sum (or average) of the marked-projects target-values. The result should end up in KPI!G31.
In other words I want
=sumif(A84:A89;"x";'X-ref'!T4:Y4)
but it doesn't work since the first range is an column-array and the second range is an row-array.
View 5 Replies
View Related
May 5, 2009
Now that the calculations are working, with the press of a button, I need to be able to select a range of dates and copy all lines within the range to a seperate sheet with the desired name under the same headings they currently reside under. I have included some modified code that is being used in another spreadsheet that was created for me, but I do not pretent to understand all of it and I no longer work with the creator of the spreadsheet. How do I use a button to open the form for date selections and entering the name of the new sheet, and then use the start button on the form to begin the matching and copying to a new sheet? If there is an easier way I am all for that too.
View 14 Replies
View Related
Apr 18, 2013
So I have this problem in excel with comparing 2 columns.
Basically, I have 2 columns(a &B) that I need to compare with one another and find out the matching data. I am trying to use that matching data to enter in our reports.
Both columns might have duplicate items because I am dealing with premium numbers.
Formula to compare these 2 columns and find the matching data and extract it to a separate column. Keep in mind, i am dealing with almost 20,000 lines of data.
View 2 Replies
View Related
Jul 15, 2009
I want the script to find if the value entered in the form is matching the values in column 'A' in the database and if it matches then it needs to select the cell as active cell - to populate the form details. And if there is no matching value found, the script needs to select the last empty cell of the column 'A' to populate the data entered in the form.
1) Form has 10 different fields that needs to be filled by the user.
2) Field 1 - is a text box for 'Request #' to be entered by the user.
3) After filling in all the fields - once clicked on OK, the form should search for the the 'request #' entered on the form in the database (Form and the database are in the same workbook).
4) If the 'Reqeust #' in the Column 'A' matches the the 'Request #' entered in the form, then the matching cell should be selected (Activecell -Were the data can be overwritten, with the new entry)
5)If there is no matching 'Request #' found in the database, the script should loop to select the next available blank cell in column 'A'. So that the form data can be entered.
View 14 Replies
View Related
Apr 24, 2009
Rylo thanks for your help on the other project. Here is step two for the same project.
Basically I'm going to list a step by step list of what needs to be done then attach some sample sets so you can see what I'm talking about.
Step 1 ........
View 12 Replies
View Related
Jul 18, 2006
I need to match up the columns of 1 spreadsheet with those of another. I have a partial address that only lists city and state in one workbook. I need to match these partial addresses up with the master list that contains full addresses. It seems like it should be an easy thing to do, but I can't figure it out.
View 9 Replies
View Related
Nov 19, 2009
programming 2 macros in a bank reconciliation sheet I am trying to create.
Basically the data consists of two sets: the ledger side and bank side. Both sides consists of multiple columns that include date, description and amount.
The following two situations can occur and which need to be covered with a macro.
Many to one matching
When we make payments to say 100 different suppliers at once, the ledger side will show 100 lines with the different amounts. However on the bank side it will only show one line with a total amount for the transaction. As the description on the ledger side is the same for all transactions done at the same time, it should be possible to have a macro add these lines and compare the total with entries on the bank side. Once a matching amount has been found, the macro should place an ‘x’ next to all entries on the ledger and bank side, in order to show that these transactions have been reconciled.
Partial cell matching
In this case we are only dealing with one line on both the ledger and bank side. The issue is that the description does not always perfectly match with one another. The ledger side might say ‘Brown Corp.’ and the bank side might say ‘Brown Corporation’. I want to come up with a macro that can recognize this partial match and still reconcile the lines by placing a ‘x’ to both the ledger and bank entry. The match however should be done with a combination of description, date and amount as several different bookings might be done for the same supplier in the same month.
View 12 Replies
View Related
Feb 15, 2010
I have a report that shows "users" in column A, "time of call" in column B and "Call direction" in column C as below
Usertime of callCall DirectionUser 112/02/2010 09:00:59InboundUser 112/02/2010 09:10:15InboundUser 112/02/2010 09:26:03InboundUser 112/02/2010 09:41:40OutboundUser 112/02/2010 09:52:11OutboundUser 112/02/2010 10:25:28InboundUser 112/02/2010 10:25:32Outbound
On a second sheet I have another report that shows the "user" in A, the "time" in B, the "Status" in C and the "Duration in status" in D. As follows
UsertimeStatusDurationUser 109:28:57Follow Up:00:08User 109:29:05Available, No ACD:04:17User 109:33:22Outbound Working01:08:37User 110:41:59On Break:02:55User 110:44:54Outbound Working:41:59
I am trying to write a formula that will show me if a user is making an outbound call and also showing on the Outbound working status, but unfortunatley these times will not match because one shows the time call was made and the other shows duration in status.
View 9 Replies
View Related
Jul 10, 2014
I created a macro that extracts two columns of numbers from one workbook and need to match them to another set of numbers in another workbook. For instance i have numbers like...
18314 907
18272 64
11005 907
11005 324
..Now i need to match these numbers up with the others to find the hyperlink associated with them.
View 5 Replies
View Related
Dec 30, 2008
I'm not sure if it's possible to do this, but I have three lists of data. One is a complete list (for example, the numbers 1-25).
The next list is a subset of the complete list (e.g., 1,3,5,7,9). Attached to these (the subset list) is another list (let's say letters, so A goes with 1, B goes with 3, etc). I want to physically move the paired entries from Lists 2 & 3 so that List 2 matches up with List
1. Let's see if I can represent this visually:
I have:
1|1|A
2|3|B
3|5|C
4|7|D
5|9|E
6|
7|
8|
...
25|
I want:
1|1|A
2|
3|3|B
4|
5|5|C
6|
7|7|D
8|
...
25|
View 3 Replies
View Related
Apr 16, 2009
I have 2 sheets in a workbook.Sheet1 is a master sheet with Customer code and there Sale.And Sheet2 is the sheet which has only Customer code.
Note: Its just a Example i have total 1924 data.
Now in Sheet 1 there are some Customer code which is Repeated some times 2 and 3 or even 4 times. In Sheet 2 Same as sheet 1 there are some data which is also Repeated. Now i how can i know which Customer Code in sheet 2 Missing from Sheet1
I have Colored Some Data in sheet 2 which is not match with Sheet1
For Example.
In Sheet 1 221000000232 is repeated 2 times but in Sheet2 has only 1 times.
View 2 Replies
View Related
Oct 14, 2013
I have data collected at 2 time points. Participants have a unique alphanumeric ID that is the same at both times. I need to merge the data into one sheet where each case has all of the information from time 1 and time 2. There are many more cases at Time 1 (nearly 2000) than at time 2 (around 340).
I have prepared an example of what I need (see below), but have lots (around 300 at each time point) more variables than what has been put in the sheet.
Example.xlsx
View 6 Replies
View Related
Dec 20, 2013
I have created two sheets: "Roles to Courses" and "Datasheet". I have attached the zip db for review - its only 314k. I need to search the Datasheet in columns N, P for values from the Roles to Courses sheet (Business Role - SAP ECC) column A and find a match in the Datasheet. When a match is found, I need the B,C,D,E,F,G,H,I,J,K columns that contains the values of the classes from the Roles to Courses sht, to be added to the field called "Training Courses" in the Datasheet.
I started a macro but wasn't sure enough to complete the commands.
View 14 Replies
View Related
Mar 4, 2014
I am trying to match certain types of data from one datasheet to another. I want to match the address from the VOA worksheet to the local occupier. telephone number and local contact which are located on the raw data worksheet.
I have used the INDEXMATCH function but it doesn't correctly match the data properly as it fills certain fields that don't exist in the raw data.
View 2 Replies
View Related
Jun 30, 2007
I need to match data with specific criteria. Details of the problem are as follows:
I have 2 sheets: "Main" and "Sub"
In "Main" there are 3 Important Columns: Col "C", "I" and "AF"
In "Sub" there are 2 Important Columns: Col "I' and "N".
Value in column "C" of "Main" is same as value in column "I" of "Sub", but not in same order.
Now the specific criteria:
If value in Column "I" of "Main" is not equal to "Zero", then the macro should pick up the value from the corresponding column "C" of "Main" and search for the same in column "I" of "Sub". After matching the same, it should find corresponding value in column "N" of "Sub". Then the macro should pick up the value from column "N" of "Sub" and put the value in the column "AF" of "Main".
This is basic requirement.
I am unable to retrieve the right value for the same.
Fine tuining will be:
If the value in column "N" of "Sub" is "Fully Automated" then it should only write "Automated" in column "AF" of "Main". And If the value is "Manual + ...." then it should write "Manual" in column "AF" of "Main".
View 14 Replies
View Related
Aug 26, 2007
I'm trying to get data from one ws to another with corresponding keys, and wondering what the best and most efficient way would be to accomplish this.
INDEX...MATCH ?
Do While Not IsEmpty(ActiveCell)...ActiveCell.Offset(1, 0).Select...Loop?
Here's the setup:2 worksheets: source and target
source ws has 2 relevant col: A and K which are key/val pairs
target ws has x number of col
val from source ws are to be written in 1st avail blank col on target ws
some of the keys will exist in both ws, some only in one
if a key from source ws is not present in target ws, it will need to be added along with its val
The # of the first avail col is targetCol:
targetCol = Cells(1, Columns.Count).End(xlToLeft).Column + 1
View 9 Replies
View Related