Getting Rows From Separate Sheet That Matches A Condition?
Mar 10, 2014
If I have these on Sheet 1
Name Age Cutoff
PersonOne 27 21
PersonTwo 21 20
PersonThree 19 19
PersonFour 17 20
generate/list/display on the next sheet (Sheet 2) of all the rows that has AGE less or equal to Cutoff, so on Sheet 2 based on the Sheet 1 data, I should get the following rows listed:
Name Age Cutoff
PersonThree 19 19
PersonFour 17 20
View 10 Replies
ADVERTISEMENT
Jul 2, 2008
I have a selection on a worksheet that has 4 consistent columns (A, B, C, and D) each with a variable number of rows all containing string type data. With this data I want to use Conditional Formatting so that when I have a string value of X in column D for any row, that whole row with the X in column D has it's color change to say grey, this should happen regardless of what strings are in Columns A, B, or C.
Below is the way I've been trying to do this thus far and failing, when I run this code below I can only get it to grey out the cell with the X not the whole row.
Selection.FormatConditions.Delete
Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, _
Formula1:="=""x"""
Selection.FormatConditions(1) . Interior.ColorIndex = 16
View 4 Replies
View Related
Jun 1, 2008
i'm trying to create a macro to find any value <> "" from COLUMN B then copy Bx;Cx;Dx and paste into another worksheet with the name of COLUMN A.
And when the cells Cx or Dx is empty should appear 0 into the other worksheet
for example.
sheet1 ..... cell("dx") is empty
a b c d
w 5 3
the macro would copy 5,3,0 and paste into sheet named "w".
i found this code on internet but it's not quite good for me because it copies the hole row. i tried everything to change that but i couldn't.
[url]
(ORIGINAL CODE)
Sub SearchForString()
Dim LSearchRow As Integer
Dim LCopyToRow As Integer
View 9 Replies
View Related
Jun 9, 2014
I want to use two separate Unit of measurement according to two condition in a same cell.
View 3 Replies
View Related
Aug 11, 2014
I need to count the number of unique text values in the first column given a condition in the 2nd column. For example, the formula that I'm looking for should give a result of "3" because it is an SME, and there are 3 unique companies that are classified as SMEs.
Company Name
Company Type
Company A
SME
Company B
SME
(I cant seem to make the tables visible but Company A and Company D right below the header should be in one cell) This should still yield a value of "3" despite having Company A and D in the same cell.
View 5 Replies
View Related
Jun 5, 2014
I am working with an excel spreadsheet. There is a column for "name", and then the next column is for medical condition.
If the same patient has multiple (say, 4) conditions, the rows for "name" are combined into a single cell(let's say, a cell going from row 2 to row 5, witha a single name in the combined cell) , with the next column having four different cells adjacent to the single cell (cell 2 has "bleeding", cell 3 has "fever", cell 4 has "diarrhea", and cell 5 has "rash"). Some patients have only single conditions, single cells.
Will this mess up COUNTS and COUNTIF?
Is there a way to split the combined cell2-5 for ''name" into four cells all containing the same name?
View 4 Replies
View Related
Feb 15, 2014
I have been using this macro to separate lots of rows with a certain amount of blank rows.
Example:
Code:
Sub test()
Dim j As Long, r As Range
j = InputBox("type the number of rows to be insered")
Set r = Range("A2")
[Code] .......
I trying to change it so that, instead of inserting how ever many blank rows, it just copys the row above.
Example (Row A to C)
I have been messing around with macro recorder and i could select each row and paste it into the blank rows, but from researching on the internet selecting and pasting data seems to be a waste of resources (ram?) and i will be running this on a couple hundred rows (lots of data). Also, i would like to keep the functionality so that i can still choose how many times it copys/inserts each individual row from a input box.
I eventually want the data to end up like it is shown in the table but i am takin it one step at time because i want to understand what the code is doing.
View 1 Replies
View Related
Nov 16, 2006
The table i'm looking up contains 2 rows with a value which matches my lookup value, how do i get the vlookup to pick up both values?
this is what i have:
ACEUSA-0017,730.84
SISTRUINSU-0018,865.69
WARNORAMER-00212,868.59
ACEUSA-00113,948.61
This is what vlookup picks up:
ACEUSA-001 7,730.84
ACEUSA-001 7,730.84
using this formula:
IF(ISNA(VLOOKUP(I13,'May 2006 MJ'!$A$5:$B$41,2,FALSE)),0,VLOOKUP(I13,'May 2006 MJ'!$A$5:$B$41,2,FALSE))
This is what i need it to pick up
ACEUSA-001 7,730.84
ACEUSA-001 13,948.61
I do need ISNA to take care of #N/A
View 14 Replies
View Related
Aug 5, 2009
See the attached xls. There are two worksheets contained therein, one with the original data, and the other showing how I'd like it organized.
I have rows of product data consisting of a product id followed by repeating attributes of quantity and associated price. I need to convert each product row to multiple rows of each quantity/price pair while preserving the id for each pair.
View 10 Replies
View Related
Aug 26, 2009
Worksheet #1:
Column "A" going down (starting at A1 to A5) I have the numbers 1,2,3,4,5 entered in each cell...
Worksheet #2:
In cell A1 is the number "1"
In cell A2 is the number "7"
I want a formula in cell B1 (WS#2) that looks for the number in cell A1 (WS#2) in the range of cells A1:A5 on Worksheet #1, and if it finds the value of A1 (WS#2) in that range of cells on Worksheet #1, it returns the letter Y... if not it returns the letter N
So my result on Worksheet #2 should be...
Cell B1 shows the letter Y
Cell B2 shows the letter N
View 2 Replies
View Related
Mar 26, 2014
I have a chart in sheet1 with 4 Code (EXPL: 0349) in a cell A2 and in Cell B2 to b1900 reasons against cell a2 so i need all matches against a2 in Sheet2 cell a2.
View 4 Replies
View Related
Sep 24, 2013
I have one column that contains a monetary amount (column AQ) , and another that contains text reading either "inflows" or "outflows" (column AC)
When AC says "inflows", AQ should be positive, and when AC says "Outflows", AQ should be negative.
I need the text in column AQ (the monetary amount) to become red when the the opposite is true.
i.e. When AQ is negative and AC says "Inflows", AQ should become red. And when AQ is positive and AC says "Outflows", AQ should become red.
View 2 Replies
View Related
Oct 22, 2013
Worksheet cells A1 – A25 have sequential numbers 1 – 24
the following elegant code generates every permutation of six numbers from the list into Cols C – H
VB:
Option Explicit
Sub Combinations()
Dim rRng As Range, p
[Code].....
View 7 Replies
View Related
Jan 31, 2014
If A1 ever equals "1", I want Sheet 2 to automatically be displayed.
View 1 Replies
View Related
Jun 12, 2008
I have worked on the code – with as limited knowledge as I possess – to perhaps communicate my intention. I know for a fact that in the code below there are 2 problematic lines – and herein lies the root of my problem. The first line is: “Dim Day As String” In Debugger speak, I am told that this cannot be done along with “Set sh = Worksheets(Day.Value)”. However, in normal speak, I am trying to copy data from one sheet to another. When pasting the data on the second sheet, I am trying to make the code find the appropriate sheet that matches a Day value in Cell I5. Getting the code to execute this one action is proving to be particularly difficult. I am thankful for any suggestion on how to get the code to work correctly.
View 14 Replies
View Related
Nov 13, 2009
I want to vlookup from sheet2 cell E2 to find all matches in sheet1 in coulmn G and add totals together in coulmn E. The match I am looking for is used in several rows of coulmn G on sheet1. I only want cell E2 on sheet2 to give me total amount from data in coulmn E of sheet1 when a match is found in coulmn G of sheet1.
View 9 Replies
View Related
Jun 21, 2008
I have an imported report in a spreadsheet. It imports to three columns. I need to check each row in column A for three seperate criteria and delete the rows I don't need. I need to delete blank rows and check next row for page header info. Delete these and next rows to next blank cell. Check next row for page header and not delete if not page header. Several rows down will be a cell with 23 blank spaces before the word Reg: and sometimes other words past this but always this first. This row is to be kept. I looked at the FAQ's example of Deleting but I don't think it will work. I also need to put a key word in column A at a point where I want to stop. This report is a couple thousand rows long so a VBA procedure would really save time. I have a procedure I use to check for two zero's in two cells that hide these rows but I couldn't modify it to work on this report.
View 9 Replies
View Related
Jan 20, 2009
I would like to match column data in a source spreadsheet to column data in a target sheet. If a match is found, I would like to copy the corresponding row range from the source sheet to a separate, third sheet. For values where no match in found in the a target sheet, I would color the unmatched cell in the target sheet red. If a match was found, the cells would be colored green. The data in the Source sheet is in column A, while the Data in the Target sheet is in Column T. The data will be pased in the third sheet in Column T preserving original formats
I have this code, gleaned from several postings on this forum that somewhat works. The problem is that I get false mismatches (i.e. some cells get colored red even when there is a match and the data got copied to the third sheet) even though there are no duplicates. I have made sure that the formats are identical in both Target and Source sheets to try to fix this. Also, I don't want to cut the entire row , but just copy and paste a row range onto a third sheet. The column and row ranges are variable. I am attaching a file.!!
Sub CutRows()
Dim i As Long, k As Long, n As Variant, r As Range
Application. ScreenUpdating = False
With Sheets("Source")
Set r = Range(.Cells(1, 9), .Cells(65536, 6).End(xlUp))
End With
k = 0
i = 6
While Not IsEmpty(Sheets("Target").Cells(i, 20))
n = Application.Match(Sheets("Target").Cells(i, 20).Value, r, 0)
If IsNumeric(n) Then
Sheets("Target").Cells(i, 20).Interior.ColorIndex = 35
k = k + 1
Sheets("Source").Rows(n).Cut Sheets("Sheet3").Rows(k)
Else
Sheets("Target").Cells(i, 20).Interior.ColorIndex = 3
End If
i = i + 1
Wend
Application.CutCopyMode = False
Application.ScreenUpdating = True
End Sub
View 7 Replies
View Related
Sep 6, 2006
I have a spreadsheet that is updated daily with data that falls into one of two categories: a) completely new to the sheet or b) existing from the day before but not taken care of yet. The items which fall into category a are evaluated, and notes added to the sheet. The items in category b must be compared to the new data, and duplicated lines deleted but notes from previous evaluation must be kept on the sheet. In addition, anything on the sheet that is not included in the new information needs to be deleted. I've set up a sheet with all old and new data with dates the data showed up as well as the notes associated with the old data, and have concatenated all the info from each row into column V (from another suggestion I got on a similar but not exactly the same problem which I also still haven't figured out). The sheet has been sorted by col V so any matching rows should be within 3 or 4 rows of the original. The problem is that my code does absolutely zilch!
Sub DeleteRepeatedRows()
' goes through coord. sheet and identifies duplicated lines, copies the date from the old row
' copies it into the new line, then deletes the old line
Dim rCell As Range
For Each rCell In Selection
If rCell.Value = rCell.Offset(1, 0).Value Then
rCell.EntireRow.Delete
End If
If rCell.Value = rCell.Offset(2, 0).Value Then
rCell.EntireRow.Delete
End If.........................................
View 7 Replies
View Related
Sep 3, 2009
I have two worksheets. First one is TchNfo. Next is WrkMnShp. TchNfo has a range from A2:A93 with info in columns A,B,C,D, & E.
Is there a macro that I can run where if I enter a number in WrkMnShp column A, the entire row that matches the number in TchNfo is copied to WrkMnShp?
View 13 Replies
View Related
Sep 22, 2009
I have a Excel file with alot of data in it. I need a macro that will create a report for me and relive me from alot of manual work. The 1st sheet is named "Projects". This contains the search arguments. The 2nd sheet is named "Database". This is the sheet where I want to search in. The 3rd sheet is named "Report". This will contain the results of the search. So the going will be something like this:
Copy row 7 from "Projects" into row 7 in "Report". Then use the value in that row, column E (named Search code). Search for rows that has this value in column E in the "Database" sheet. Copy all those rows to "Report" sheet. Copy row 8 from "Projects", leave two rows of space and paste into "Report". Repeat the procedure mentioned above. Repeat this until reaching a row in "Projects" that has no value in Column A.
View 5 Replies
View Related
Sep 29, 2012
On a worksheet named Season Results, I have a list of venues in column A, and a list of dates in column B
I then have worksheets named with all the venue names.
On the venue worksheet, I want the corresponding date from column B automatically displayed in a cell.
View 7 Replies
View Related
Oct 25, 2013
What I am trying to do is, check if the value of c2 in update is the different to the value of c2 in original then run a code (for the moment just says msgbox so I know it works).
Code:
Sub what_needs_update()
'UPS = Sheets("Update").Range("c2:76")
'ORS = Sheets("Original").Range("c2:76")
For Each cell In Sheets("Update").Range("c2:S76")
[Code] ..........
View 3 Replies
View Related
Jun 26, 2009
I have two sheets (sheet 1 and sheet 2). Sheet 2 has a range of data about employees. Column A contains a unique reference number with the rest of the row (Column B - Column X) containing corresponding data about that empoyee.
When I enter that unique reference number in Sheet 1, Column A, and matches the value in Sheet 2, Column A; I would like the rest of the corresponding row data (Column B - Column X) from Sheet 2 to populate 'automatically' (copied) in Sheet 1.
View 9 Replies
View Related
Dec 23, 2007
I have a workbook with two sheets imported from different sources. Sheet 1 is an AdHoc query from an Oracle 10g based program. Sheet 2 (PBIC 8 in my file) is a report generated from a property accountability program. The information from Sheet 2 is manually inputted into the Oracle program that generated Sheet 1.
I would like to have a macro that would compare the cell contents in columns "RegistrationNbr" (column S) and "SerialNbr" (column T) with the cell contents in Sheet 2 (PBIC 8). The match in Sheet 2 could be an identical match or part of a longer string. The matching cells in both sheets should be highlighted.
One thing to be considered is the column names in Sheet 1 will always be the same but the column letter designation may change base on the fields selected in the AdHoc query.
I didn't realize my file was too large and didn't upload.
View 4 Replies
View Related
Apr 29, 2009
I have several worksheets (Labeled Sheet1,Sheet2,sheet3) What I need to do is to step through each row in sheet3, and do a search in sheet1, it the data was found, then return the row number. I then will need to copy data from sheet1 (rowfound columnA , through rowfound CoulmnBd to sheet3 current working row columnK
View 3 Replies
View Related
Jan 29, 2010
In my spreadsheet, on the first worksheet called "Working". Column A, called "Results", contains carrot ^ delineated string values in each cell (i.e."john^apple^pear^banana^grape^love^heart^pickle"). The majority of string values in every cell in my "Results" column match a "source" column of Pick-List Values, called "Fruits" in the same spreadsheet, however found in a different worksheet called "Lists" (also in Column A). I want to perform 3 functions against my "Results" Column on worksheet "Working":
1.) Report In Column B: Analyze column "Results" by cell and return carrot delineated string values for only those that match my "Fruits" Pick-List
2.) Report In Column C: Analyze column "Results" by cell and return carrot delineated string values for only those do not match my "Fruits" Pick-List
3.) Report In Column D: Identify and return all unique values in "Column C" as a List.
Attached is a simple example of what I'm trying to accomplish called " Sorting.xls"
View 4 Replies
View Related
Jan 23, 2014
In sheet 1 i have the data like this
Date Amount
---------------------------
13-Mar-13
---------------------------
20-Mar-13 2000
---------------------------
27-Mar-13
---------------------------
[code]...
now in sheet 2 i need the date and amount fields in which amount is present.
i need sheet 2 like this
Date Amount
-----------------------------
20-Mar-13 2000
-----------------------------
3-Apr-13 3000
2.jpg
View 2 Replies
View Related
Jan 18, 2014
Essentially what I want to automate is a check through one list on the Sheets("Notes") in column A, with another column B on Sheets(template). If there is a match I want to insert a part of the row that the match occurred on Sheet("Notes"), and insert it above the row where the match occurred on Sheets(template).
Here is my code so far, currently I keep getting a "Application-defined or object defined error" on the line
VB:
Sheets("Notes").Range(Cells(i, 2), Cells(i, 11)).Copy
VB:
Sub add_notes(template As String)
Dim Rng As Range
Dim i As Integer
[Code].....
View 5 Replies
View Related
Mar 7, 2013
I have 2 columns,
column A has a series of 8 digit numbers (some will match some will not) sorting in A-z order from lowest to highest value.
Column B is blank at the moment.
What I want
In column B i need to add numbers starting at 1 and moving down in sequence.
If more than one rows have the same number in column A they get the same numbe rin Column B
It's really a pain or have to hand type in the numbers and I can't figure out a easy way to do this.
Attached example.
Tab 1 = Origanl Data
Tab 2 = results i'm lookin for.
View 2 Replies
View Related