Loop Through Rows And Return Matching Columns

Jan 9, 2009

I have a worksheet with 2 columns. The first column contains names and the second column contains numbers associated with the name.

How can I specify a name, go through the sheet to find all the occurances of that name and then paste all the numbers associated with that name in another worksheet in a set position.

Matching Two Columns To Return One Value

Mar 7, 2014

Alright, so I need data in column A(Last names) and data in column B(First name) to match their respective names on another sheet. When a match is made, it will return column C(Hours worked).

I originally used Vlookup to match last names, something akin to =VLOOKUP(A:A,Week1!A:P,4,FALSE)

But this does not account for employees that may have the same last names. Is there a way to combine two vlookup's? Or is Index a possible solution?

Matching Data In 2 Columns To Return 1.

Feb 19, 2008

I'm working on a excel sheet to compare data of 2 columns. One column (or array), let's say C3:C13 contains "x" in some of its cells. The other column, let's say P3:P13, contains "d" in some of its cell. What I would like to do is compare the cells of the same row, see if they contain any data and return 1.

So if C3 contains an "x" and P3 contains a "d", therefore it returns 1. If C4 doesn't have an "x" and P4 has a "d", it will return a 0.

The closest I can get to this is the following formula

=SUM(IF(AND(C3="x",P3="d"),1,0), IF(AND(C4="x",P4="d"),1,0), IF(AND(C5="x",P5="d"),1,0), IF(AND(C6="x",P6="d"),1,0)), IF(AND(C7="x",P7="d"),1,0)), IF(AND(C8="x",P9="d"),1,0)), IF(AND(C6="x",P6="d"),1,0))...

However, this formula is way too long. Is there another way of writting or simplifying this formula?

Return Value In Third Column If Values In First Two Columns Matching?

Mar 20, 2014

I have a two different workbooks book 1 and book 2 with some data.

If values of first two columns ( Column A and B) of both workbooks are matching then I want a formula that can return the value of third column (column c) of book 2 in book 1 column c.

example:

Book 1

column A / Column B / Column C

100 / 200 /

Book 2

Column A / Column B / Column C

100 / 200 / 300

now I want a formula that can return in column C of book 1 to display 300.

And the data runs across some 100 rows in both workbooks.

Compare Columns In Worksheet And Return Row Value For Matching ID

Jul 17, 2013

I have used the merge facility to incoporate all the worksheets into one excel files. As they all have same heading, I have sorted the data, first by their account expiry time (oldest to newest) and then by manager (A-Z)

For example, system report generated on 15/03/2013, 28/03/2013, 03/04/2013, 15/05/2013, 28/05/2013 and so on and these are sheet names too. What I want is one worksheet called report with the same heading as my merged worksheets and return values where Column C in 28/03/2013 is compared to 15/03/2013 and if the employee ID matches than return the whole row of data for the report.

the next query would then be for finding employee ID in 03/04/2013 and comparing it with 28/03/2013 worksheet and returning the matched ID in report worksheet.

This is the layout of the report worksheet.

Display NameEmployee IDAccount StatusE-mailDepartmentManagerComment
15/03/2013 to 28/03/2013
28/03/2013 to 03/04/2013
03/04/2013 to 15/05/2013
15/05/2013 to 28/05/2013

so for the above report worksheet, if employee id matches the two compared worksheet (15/03/2013 to 28/03/2013) return all value (Display name, employee id, account status, email, department, manager, comment) from the 28/03/2013 and so on.

Lookup Across Columns & Return Matching Detail

Feb 26, 2008

I am trying to track a score. A master capacity sheet has two columns with identifiers (upstream and downstream nodes) relative to a pipe segment. I have a separate sheet (condition sheet) with the corresponding scores. I want to enter the upstream and downstream node numbers in 2 columns (A & B) in the master capacity sheet, and based on the the upstream and downstream node numbers, have the corresponding score (from the condition sheet) on that row copied in the master capacity sheet.

Looking Up And Matching Rows To Columns?

Sep 17, 2013

I have a document where there are hundreds of rows and columns. The rows contain lines of data, while the columns are topics. Each row needs to be traced to an appropriate column. Once traced, I simply check off the appropriate cell with an X. I have to make sure that each row has at least one "X".

I have attached a sample file. look at cell B8. The statement in this row reads "Issue Placard information and registration". Now, I already know what column this statement belongs to (column CT).... but I don't want to scroll over hundreds of columns to that particular column, or have to freeze any panes, to locate that cell and mark it off. I have been doing this manually and it is incredibly tedious and time-consuming. Is there a way where I can locate the appropriate cell and go to it without having to scroll? When I'm scrolling I have to not only scroll, but I have to read the rows and columns again to make sure they indeed match. I want to be able to locate the right cell instantaneously and just enter an X value.

Looking Up And Matching Rows To Columns

Nov 1, 2013

I have a document where there are hundreds of rows and columns. The rows contain lines of data, while the columns are topics. Each row needs to be traced to an appropriate column. Once traced, I simply check off the appropriate cell with an X. I have to make sure that each row has at least one "X".

I have attached a sample file. look at cell B8. The statement in this row reads "Issue Placard information and registration". Now, I already know what column this statement belongs to (column CT).... but I don't want to scroll over hundreds of columns to that particular column, or have to freeze any panes, to locate that cell and mark it off. I have been doing this manually and it is incredibly tedious and time-consuming. Is there a way where I can locate the appropriate cell and go to it without having to scroll? When I'm scrolling I have to not only scroll, but I have to read the rows and columns again to make sure they indeed match. I want to be able to locate the right cell instantaneously and just enter an X value.

Highlight Non-Matching Rows In 2 Columns

Nov 21, 2006

I need to run a macro that compares two columns and Highlights the ineuality rows in both columns

Formula To Find Matching Values In One Column And Return Totals For All Rows That Match

Dec 26, 2013

table1.jpg

I am looking for a formula that will satisfy the following:

1) find all the values in column "A" that match
2) In column "G", sum up all the values in "F" that go with the matching values in column "A"
3) For example, in rows 14-16, the values in column "A" match. Cell G16 sums up F14:F16

Matching Then Aligning Data Across Rows And Down Columns

Dec 22, 2008

I have what I believe to be a simple problem, but for the life of me, i can't seem to figure it out.

I have a list companies in column A that have a corresponding revenue number in column B.

In column C, I have ANOTHER list of companies and their corresponding revenue number in column D.

Example:...

Compare 2 Columns Delete Rows With Matching Values

Feb 5, 2009

I've got two workbooks, Workbook1 with a list in column a and Workbook2 with a list in column F. I want to compare the cells in these columns and delete the entire row in Workbook2 if there is a match.

Compare Two Columns & Copy Matching Rows To New Sheet

Feb 4, 2008

I need to track only certain tasks id's out of entire task id database. I have 1 column of data on sheet "A" that represents task id's I want to track. On sheet "B" I have multiple columns of data, the first column being the task id's. I need to compare the column on sheet A with the first column on sheet B. If there is a matching task id, I need to copy the entire row of data from sheet "B" on to a new sheet "C". If there is no matching task id on sheet "B", I would like to copy just the task id. Each week I would get a new set of data for sheet "B" (which can vary in length) and I need the ability add or subtract task id's on sheet "A" that need tracking. See the attached xls file for a piece of sample data.

How To Loop Through Specific Columns And Rows

Mar 25, 2014

I am stuck with looping columns and rows.What i am trying to do is... I have to loop through columns E3 to G3 and also rows of each column and check for a condition inside the column.How can i achieve that? I have the following structure.. How can i code it?

For i=E3 to G3 'Column loop
for j=4 to 47 'Row loop
'code to check if the value isnumber
next j
next i

How To Loop Through Dynamic Ranges Using Columns Rather Than Rows

Jun 23, 2014

I have a list of several hundred columns, beginning with column "G:G", with varying numbers of rows of data in column - each row dipicting a monthly data point. I'd like to average the numbers in each column (need to average over the appropraite time-frame) and compare that average with the corresponding average (same time-frame) for benchmark (column"F:F"). The problem is I don't have the same number of data points in each column; some have data points for every month for the past 33 years, and some just a few years; almost all have differing beginning and ending dates as well.

[Code] ....

VBA Macro To Loop Text To Columns Through All Rows Of Data?

Apr 17, 2014

I am trying to get a macro to run in excel that takes a simple text to columns command in one line of data and runs the command on a loop through however many rows of data there happen to be.

I've attached two screenshots - one with what I've got now (Before.jpg) and what I'd like to have after the macro runs (After.jpg). The code below is what I used to get the first text to column breakout, which I can hopefully run on a loop to breakout anything in the DEPT column that contains a "/". It can ignore the rows that only have one department to begin with.

Selection.TextToColumns Destination:=Range("K2"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, _
Semicolon:=False, Comma:=False, Space:=False, Other:=True, OtherChar _
:="/", FieldInfo:=Array(Array(1, 1), Array(2, 1)), TrailingMinusNumbers:=True

Eventually I'll want to create another macro that transposes the breakout text back into the DEPT column and populates it with the corresponding data, but I figure I'll take things one step at a time.

Attached Images
Before.jpg‎
ter.jpg‎

INDEX Returns On Rows - To Return In Columns

Aug 18, 2008

I'm using the following to return multiple reponses to a criteria. However, it returns the answers in rows. i.e. A1, A2, A3. I want it to return in columns. i.e. A1, B1, C1.

=INDEX(RMList!\$A\$1:\$B\$32381,SMALL(IF(RMList!\$A\$1:\$B\$32381=Errors!\$D\$2,ROW(RMList!\$A\$1:\$B\$32381)),ROW(1:1)),2)

Compiling Partially Matching Data Into Matching Rows With Macro

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).

Return Multiple Values From Columns To Rows Between 2 Dates

Feb 8, 2013

I got a good start on what I need to do from this thread here: [URL] ......

A user will use a userform to enter in results from a room inspection into one sheet and then on another sheet selects the maid and it pull up the matching room inspections. I wish to then limit it to a date range which can be found in two cells.

Currently cells D2:H2 contain the array

[Code] ......

and cells D3:H3 contain

[Code] .........

I would like to further limit those searches by restricting the date range, Cells D4 and E4 contain the first of the month and last of the month respectively.

I would like to avoid the easy answer, start a new workbook each month, but I won't be the person entering the data or using the separate sheet to conduct performance reviews so it needs to be one workbook that lasts from month to month.

Return Multiple Values Across Columns And Rows Based On Criteria

Jun 20, 2008

I have a table with column headings of product ID Numbers (eg.1111) and row headings of Store number (Eg.1) with data showing the time each product was last sold at that store, I need something to consolidate for each store which Product ID's were sold prior to 5pm and what time they were sold.

EG

Store 1 1111 16:40
2222 13:00
Store 2 1111 15:05
3333 16:50

Matching 1 Value In A Loop?

Dec 21, 2009

If the following macro matchs two ID numbers from column B in column C it shoud highlight them green.

Column C may has multiple entries of column B, however the macro i have written appears to only match the first ID number found in column C from B.

I think this may have something to do with my loop, can anyone suggest a solution?

VBA Matching >1 Value In A Loop?

Dec 20, 2009

If the following macro matchs two ID numbers from column B in column C it shoud highlight them green.

Column C may has multiple entries of column B, however the macro i have written appears to only match the first ID number found in column C from B.

I think this may have something to do with my loop, can anyone suggest a solution?

Sub colour_filter()

Dim myrange As Range
Dim Rng As Range
Dim rng1 As Range
Dim a As Integer

Set Rng = ActiveSheet.Range("B2", Range("B" & Rows.Count).End(xlUp))
Set rng1 = ActiveSheet.Range("C2", Range("C" & Rows.Count).End(xlUp))
a = 0

For Each myrange In Rng
If IsNumeric(Application.Match(myrange.Value, rng1, 0)) Then
rng1(Application.Match(myrange.Value, rng1, 0), 1).Range _
("A1", Cells(1, Columns.Count).End(xlToLeft)).Interior.color = vbGreen
a = a + 1
End If
Next myrange

MsgBox "Number of matches: " & a

End Sub

Loop Matching Data Between Ws

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

Matching Data - Loop

Sep 5, 2008

What I am trying to do is pretty simple (this is what I imagine)

I have a 4 columns
- the columns 1 and 2 contain a number of days and an associated number
- the columns 3 and 4 contain a number of days and an associated number

My formula should do this:
- if the number of days (col 1 and 3) are the same, then multiply the number in col 3 and 4 together.

- more specifically, for each number in col 1, the formula looks all matching values in col 3 and makes a simple calculation
- result displayed in column 5

Constraints
- col 1 has more data than col 3
- the data in both column are not sorted

Dim x As Integer

For x = 1 To 10 Step 1
If Cells(x, 1) = Cells(x, 3).Value Then
Cells(x, 5).Value = Cells(x, 3) * Cells(x, 4)
End If
Next x

Store Row Number Within Loop And Delete All Stored Rows After Loop?

Sep 11, 2013

I have working code that returns a row number within a for loop based on parameters I set.

Each time the for loop runs I would like to store this row number, then after the loop has finished, delete all stored rows.

Code:
for rowNum = 1 to x (some variable end row number which I already have worked out using End(xlUp).Row)
if x = y then
*storedRow = rowNum
end if
next rowNum
*

Lines with a * are the bits I can't work out. I've been trying to understand arrays by reading posts on what other people have done, but I can't fit (or fully understand) the reDims, or reDim preserves into my code. I've seen what appear to be quite complex ways involving uBounds and LBounds, but unfortunately I can't see how to use them.

All I want is to simply keep adding a row numbers to a variable, (i.e. row 2, 5, 20, 33, 120, etc) and then delete those specific rows.

Loop Through All Folders In A Directory - Find Matching File

Jun 28, 2014

Code that loops through all folders in a directory, to check each workbook in each of those folders. If any workbook name in any of these folders matches a predefined string, then open this workbook for some other codes to run.

Lookup And Return Matching Value

Jul 24, 2009

In column "AT" I have a list of matchups between 2 soccer teams that looks like this

Row 1:Manchester UnitedArsenal
Row 2:Chelsea FCLiverpool
Row 3:TottenhamAston Villa
Row 4:Hull CityLiverpool
Row 5:Everton FCSunderland
Row 6:Bolton WanderersManchester United
Row 7:PortsmouthTottenham
Row 8:Birmingham CityStoke City
Row 9:WiganBlackburn Rovers
Row 10:LiverpoolFulham

In columns "AM" and "AN" I have a rating for the home and away team. So for example, AM row 3 would show the rating of Tottenham and AN row 3 would show the rating of Aston Villa.

Now what I want to do is set things up so that I don't have to enter every teams' rating in manually. I need a formula that would look from bottom to top (row 10 to 1), find the first row that contains Tottenham (for example), and then look to the right to either column AM or AN (depanding on if Tottenham is the first team in the matchup or second) and return the value in that cell.

Return Value After Matching Two Variables

Dec 10, 2006

I am attaching a sheet wherein I have tried to match two variables and to return the appropriate value. But I find the formula returns the value which one cell below the correct answer.

Return Matching Name To ID In TextBox

Apr 7, 2008

I have a userform with several textboxes. I am trying to get one of the textboxes to auto populate based on the entry in another textbox. example: I want to enter a customer ID in one box and then the customer name to automatically appear in another box. The customer ID and names are stored in another workbook.

Return All Matching Occurences

Apr 15, 2008

I'd like to evaluate a series of columns where a value greater than 1 would return all matches in another worksheet. I can't seem to use LOOKUP or Pivot Tables effectively to do this.

For example