VBA Lookup Function: Paste Data Into A Cell In Another Worksheet, Based On Criteria Specified In Sheet1
I'm looking to create a macro that will take data from an input sheet, and paste it into a cell in another worksheet, based on criteria specified in sheet1.
Specifically in the attached example, the macro would copy the data in cells C8:C10 of sheet 1, then paste them into sheet 2 based on the data specified in cell B3 i.e. it would paste them into the column headed Mar-09. I intend to make this cell a drop down, so that the user can then select the next reporting month and run the macro again to paste the data into the Apr-09 column.
View Complete Thread with Replies
Sponsored Links:
Related Forum Messages:
How Do I Use Lookup To Find Data Based On 3 Criteria
I have a bit of a challenge. You'll have to take a look at the attached files to understand what I am trying to do. I am asking for your advice. I am creating multiple spreadsheets (QPPcompany.xls) that will refer back to a master data(QPPdata.xls) file. I am trying to figure out how to best set up the data file so that I can do lookups on the data from the referencing files. Here's the challenge. I need to be able to find in the data page the company name in Column A and then how many L's (or C's or P's) they had in a specified month. So for instance I need to be able to find the number 3 in cell E6 and place it in B15 of the referencing file. The required criteria for lookup are Company Name, Month and then L, C or P. So my question is, is this possible with how my data file is currently set up? I think it may be a problem to have the month/year in row 4 refer to 3 different colums for each month (L, C and P). I don't mind making changes to the data file to make these lookups possible and I think it may be necessary.
View Replies!
View Related
Lookup Data In Another Workbook Based On Criteria
I have a work book with several work sheets, what I'm trying to do or find a a method of coping data from one sheet to another provided the data in any given cell matches a specific criteria. Example below: Work sheet 1 is the primary sheet in the work book on this sheet I have a cell with a text value (Bob). Ok on the next work sheet 2 I need to search for a cell that contains (Bob). When or if it is found I need information from other cells in that row (where Bob was found) copied to work sheet 1 in a specified row and colum. If it is not found a negative value can be placed in the specified cells.
View Replies!
View Related
Return Data Based On Lookup Criteria
I have an array in excel, 4 columns: Month, Day, Stock, Price. I dont know the most efficient way to handle arrays. I know i can loop through an entire array to find a specific value, but if i have a large array, this doesnt seem efficient. For example, I would like to find the price in an Array (or Range), when i know the value of two columns. If this were in a database, I would write sql like this: " select Price from TABLE where month = 1 and Day = 3". The result would be 40.21. How can i do this with an array? I have attached a sample spreadsheet with the example mentioned above..
View Replies!
View Related
Automatically Copy/Paste Data From Input Range Based On Criteria
I have a workbook with 2 - worksheets "DATA" and "LETTER". The "DATA" sheet has columns "First Name" "Last Name" "Address"...etc. The user can enter in either a "X" or a "x" in cells B6:B100 on the "DATA" worksheet. After the user enters a X or x and hits the macro button I need it to copy certain cells from "DATA" worksheet to "LETTER" worksheet. I have listed a example below. In this example if a "X" or "x" is entered into B6 on "DATA" worksheet and the macro button is hit, then: ....
View Replies!
View Related
Two Page Lookup Matching Criteria Based On Cell Value
I have an items list on page 2. On page 1 I want to create a drop down menu in C2 that references the list on page 2. Then when I choose an item, I want the additional information in cells D2 and E2 to come in automatically. The list on page 2 will be expanding daily, and when I expand it I can simply insert a new row so I correctly alphabatize it instead of constantly having to resort it. With that said.... 1. How do you put in the drop down box that references information on a different sheet? 2. What is the best way to reference the information in my ever expanding situation: Index/Match, Vlookup, Lookup, or something I havent mentioned?
View Replies!
View Related
Copy Row Data To Another Worksheet Based On Criteria
Data exists in a workbook's sheet name "0293" in columns A, B, C, & D. If a row's value in column B exceeds zero, the entire row & formatting needs to be added to the bottom of data in a sheet called "Comprehensive" of the same workbook and put 0293 in column E of the same row. What would be the simplest VBA code to copy sheet 0293's data & add it to the "Comprehensive" sheet with the sheet name in column E of the same row?
View Replies!
View Related
Copy Row From Sheet1 To Sheet Based On Cell Value
i'm trying do is have information from sheet1 copy to sheet2 upon selecting a value from a DV list. Based on my attached sample, in Column J, upon selected "Yes", I would like to get the information from A6:H6 copied to sheet2 in the same row. I've tried it with the "if" formula and writing a macro for it.
View Replies!
View Related
Copy Data From Cell In One Worksheet, Add Text, And Paste To Cell In Another Sheet
I have the following code in another workbook that is used to populate a cell on the same sheet based on input to cells in column 'A'. Is it possible to modify this for the attached workbook to select a cell with data (numbers) on the Input Data sheet in column 'E', add text to the beginning, ('CG' in this case), and paste the result to the Import Template in the corresponding cell of column 'A'? I currently have a formula copied to dozens of cells in 'A' but since the number of rows for the Input Template is variable, there are usually cells in 'A' that contain CG but no corresponding data in the rest of the row.
View Replies!
View Related
Use IF/Lookup Function In Multiple Criteria
I have table product that include (wide 1,wide 2,thick 1,thick 2,long 1,long 2,Price) And I have table transaction than have wide, thick, long and price) I want that price in table transaction fill automaticly from table product where ( wide between wide 1 and wide 2 ) and ( thick between thick 1 and thick 2 ) and ( long between long 1 and long 2 ) excelformula.gif pricing.xls
View Replies!
View Related
Lookup Data Based On Cell Content
I am setting up a worksheet (1) with a full list of part numbers supplied, cost etc. ie: Part Description Price Qty 1234 Blah Blah £1.00 1 1235 Blah Blah £3.00 0 1236 Blah Blah £2.00 2 And I have set up a seperate worksheet (2) as an invoice. What I have been trying to do is when I enter a qty in worksheet (1), worksheet (2) will reconise an entry in the qty colum an copy selected fields/ cells. I can do a "=" or use an "if" statement looking at anything greater than "0". but is there a way I can get the invoice worksheet to ignore any lines with "0". So it will only copy over the information with only qtys for the invoice ?.
View Replies!
View Related
Paste Data To Next Empty Row Based On Cell Contents
I am trying to write a macro to do the following: Loop through a range of cells on a worksheet Sheet1 M17:M46 and if there is text in the cell then Copy all the data to the left Of Coumun M in the same row and paste the values to the next open row of a range A17:L46 on another worksheet (sheet2.) Basically the text in column M is an idicator to add the data to an order sheet. If there is no text don't add the data , look in the next row etc. I'm not sure if this is the way to go Sub CopyRows() Worksheets("sheet1").Select FinalRow = Range("M65536").End(xlUp).Row ' Find the last row of data ' Loop through each row For x = 2 To FinalRow ' Decide if to copy based on column M ThisValue = Range("M" & x).Value ' could be any value If ThisValue = "yes" Then Worksheets("sheet2").Range("A" & x & ":L" & x).Copy Worksheets("sheet1").Select NextRow = Range("A65536").End(xlUp).Row + 1 Range("A" & NextRow).Select ActiveSheet.PasteSpecial = xlValues Worksheets("sheet1").Select End If Next x End Sub
View Replies!
View Related
Lookup Based On 2 Criteria
I need to take a value from an adjacent cell and automatically enter that value in a specific cell in table on a second worksheet. The cell must match two criteria specified in the previous two ceels to the value. The table is made up of dates and colours, it seems simple in my head but I'm not sure where to start, i would like to use a macro so when a specific key is pressed the information is automatically entered into the relevant cell.
View Replies!
View Related
Lookup Value Based On Two Criteria
I have two pivot tables (for sales and purchases) with three columns each, ie: company 1, company 2 and amount I need to reconcile that for the internal purchases and sales the sale value is the same as the purchase. So in first pivot table (purchases) I have one row with internal transactions where company 1 = AZS, company 2 =YDR, value 100 In second pivot table (sales) I have one row with internal transactions company 1= YDR, company 2 = AZS, value 95 I would like to develop a macro that would check automatically the combinations of companies and find out if there are differences between sales and purchase. So in the example it should show that there is 5 usd more in purchases. Hopefully normally is zero
View Replies!
View Related
Auto Copy Part Of Row In A Worksheet To Another Worksheet Based On Criteria
I'm a novice Excel 2007 user and appreciate all the help I can get. I have a workbook with monthly worksheets in it. When a certain data Type is selected from a drop down menu in that monthly worksheet than I would like to have it automatically enter specific data (Name, Date, Eval, Type) copied to another worksheet (CC) in the same workbook. I have been manually entering the data so far. Another thing, some of the data will be entered into the Monthly worksheets and some will only be manually entered into the CC worksheet so it would need to accomodate both methods of data entry. Please let me know if I need to clarify. I have attached the workbood, too.
View Replies!
View Related
Lookup Multiply Based On Certain Criteria
I have two worksheets, one is setup with a part number only and the months Jan-Dec. The other worksheet has those same part numbers, but it also has the quantity and the months Jan-Dec. I need to do a lookup to find the part number, multiply it by the quantity on that given line, and then multiply it by the quantity in the month. I will show you how my worksheets are setup: Worksheet1: Qty P/N Jan 1 123456 100 1 123456 100 2 456789 50 4 123456 25 3 345678 500 1 456789 75 Worksheet2: P/N Jan 123456 Sum of ALL Jan Demand * the Quantity of each item 345678 Sum of ALL Jan Demand * the Quantity of each item 456789 Sum of ALL Jan Demand * the Quantity of each item
View Replies!
View Related
Result Based On Two Criteria Lookup
See the attached file. I think index and match may help me having done a search several times in these forums, but having been trying to do this for several hours I am just struggling to understand each part of the formula unfortunately. I have a list of data (cellsA1 to C33) which I need to use as my source for the information that is displayed in cell I2 based on the two selections made in cells F2 and G2. I can't use filter and data sort in this situation - I am creating a spreadsheet for someone who truly knows nothing about excel, so I need this to be as simple as pointing and clicking at cells F2 and G2 and the formula doing all other work. Is it possible to do what I am asking for (hopefully the fact that peoples' names are repeated and months are repeated won't cause a problem?
View Replies!
View Related
LOOKUP / MATCH Function To Lookup The Owner Name Typed In Cell
I have a workbook with 2 different types of sheet - 1 containing source data and the others 'collecting' data from the source sheet, depending on what the sheet is for. For example, the data source contains different pets, their names, ages and their owners. The other sheets are on a one-per-owner basis. What I would like to do is use a LOOKUP / MATCH function to lookup the owner name typed in cell A1 of the output sheet and match it with the corresponding owner name(s) on the source sheet. I would then like it to return with each pet and append the results on the sheet accordingly - like below: John Smith (in cell A1) Pet - Name - Age ------------------- Dog - Rover - 3 Goldfish - Tom - 1 Gerbil - Chewit - 4
View Replies!
View Related
Lookup Function To Lookup For Data In Another Table
I am trying to use lookup function to lookup for data in another table (we call it table A). Unfortunately, whenever the code is not in the table A, Excel will return the data from the previous row.... is there any possible way to prevent this... in another word, if the code does not exist in the table A, I want Excel to return 0 or some other figures.
View Replies!
View Related
Paste A Value Within A Row Based On Column Lookup Containing Dates?
I'm looking to create a small section of VBA code on Excel 2007 that looks for a specific date on a column and then pastes a value on the correct row. I have weekly dates in columns along the top of my spreadsheet on row 3: C3 = 07/11/08 D3 = 14/11/08 E3 = 21/11/08 etc... The row further down the spreadsheet that I wish to use is selected by previous code and could be any row number within column B. I need a snippet of code that searches for a particular date along row 3, and then once it finds the correct column, it pastes the value in the corresponding cell on my active row. For example, if my active cell/row happens to be on B18, and the date I'm looking for happens to be on L3, I need to paste a value into cell L18. I imagine there needs to be some form of HLookup, but I've no idea how to implement this in VBA code.
View Replies!
View Related
VBA Lookup Value Copy, Paste Values Between Two Workbooks
I have a standard template worksheet called "Input" (the workbooks name is "Input Capture") which spans C12:U1100. In addition I have a seperate worksheet which is based in an all entirely seperate workbook called "People Data" (the workbooks name is "Succession Planning") which again spans C12:U1100. What I would ideally like is a macro which matches the value in column C and populates the entire row (much in the same way as a HLOOKUP, only pasting values) with the exception of columns M and Q.
View Replies!
View Related
Updating Contents Of One Worksheet Based On Criteria In Another Worksheet (2)
OK, two files attached in the zipfile, pricelist-half.xls and pricelist-full.xls The background is that i exported a file from our warehouse system so we could update prices and re-import it. That is the pricelist-half.xls After our staff had spent a few days working on it, it came to light that (as the name suggests!) its only about half the products that should have been exported that are on the list. Hence the second file, pricelist-full.xls which as its name suggests is the full product list. What I need to happen, to make this as painless as possible, is somehow for the items/rows that are on the full list, but not on the half list to be inserted to the half list but also have a yellow background for their rows so they stand out clearly.
View Replies!
View Related
Copy And Paste Values Based On A Criteria
a VBA code to do the following: I have a worksheet consist of some 17,000 records - from ColA:ColDZ. In Datasheet, I have all values. From this, based on some values in ColA all records should be copied into another sheet(s). I have attached a sample workbook in which I have explained the requirement.
View Replies!
View Related
Transfer Copy/paste Based On Criteria
6 worksheets ("Monday" ,"Tuesday" etc) 1 Worksheet (call it Main) In the Main sheet let's say there are 3 column headings - Date, Inv No, Amount I want to copy from the Main sheet to the appropriate day e.g if the dates in the main are13/01/10 and 14/01/10 then all the info pertaining to 13/01/10 should go to the Wednesday worksheet.
View Replies!
View Related
Copy/paste After Search Criteria VBA
Basically a VBA code for a Command Button which when being pushed looks for the last cell being used in column A and copy/pastes rows 1 to 19 right in the next cell where this X (just an example..X could be anything basically) would be found. My columns go up to BU.
View Replies!
View Related
Lookup Based On One Criteria & Skipping Blanks
I'm looking for a formula for return a result only when one other criteria is met. I've looked at SUMPRODUCT and VLOOKUP as options but haven't been able to make them work. Here is what I need: I want cell E33 to look up cell B33 in 'Test Result Table' and return the 12th column of information, but only when cell C33 and 3rd column in 'Test Result Table' match. If the first result isn't a match I want the lookup to skip it and return the first available match. I don't want to add anything, I just need a match returned based on C33 and the 3rd column being equal (cell C33 is a VLOOKUP of the 3rd column in 'Test Result Table').
View Replies!
View Related
Find Worksheet Based On Data In A Cell
In Sheet1 I've got a list of names in column A, then I've got a worksheet for each name in the list. I'd like to fill in column B with information from the worksheet of the same name as in column A. Quick example...name in column A is Davis, want to fill in column B with a value from cell C3 on worksheet named Davis and do it for the entire list. Data being looked for is in same cell on each worksheet. Tried using a formula and dragging it down the list, problem with that is it doesn't change the sheetname just the cell.
View Replies!
View Related
Lookup Function Based On Multiple Cells
in the lookup function listed below, it only produces a result for the first exact macth. well, what if the data i am searching on could result in multiple results? i would like advise on how to modify this formula to bring back the 2nd, 3rd, 4th, etc instance of a match in the lookup array. the original formula , i found on this site, allows you to combine multiple cells to create a unique reference, and then search in another table containing columns of those combined cells, and results in the intersection of a row and column and that is the data you want returned .... kind of like a hlookup, but you can use one or more cells to create the unique lookup, and bring back whatever column you want (where as a hlookup is limited to searching the left most column and bring back a column to the left) here is the formula: {=INDEX(data to retrieve,MATCH(cell1&cell2,table to find cell1 in&table to find cell2 in,0))} "data to retrieve" is an array of one column containing the data you want to retrieve "cell1&cell2" is a combination of cells to make the unique lookup (this could just be one cell if you wanted) "table to find cell1 in&table to find cell2 in" is a table array to look in to find the look up value
View Replies!
View Related
Lookup Data In Row & Cell Based On Data In Row And Cell
I am looking for a way to do what i would call a dual vlookup. i have some data in a number of sheets and need to do some consolidation into a summary sheet. problem is, not all the sheets have data in the same columns and rows but all the data is the same. what i am trying to do is something like vlookup("a",sheet2!A:M,***need to put the column of the data here***,0) i cant just put in the column number because it changes on each sheet, need some way to do another lookup there, like an hlookup or something, so that i could lookup which column contained 'sales' and return that number so it can be put into the vlookup.
View Replies!
View Related
Copy Paste Multiple Criteria Based Rows To New Sheet
I need to copy specific rows that have a specific value in colum B and Colum M to new worksheets. So from attached screenshot , say for an example macro shud filter rows that have "BigPond" in coloum B ,"RG2" in column M & "INT" in column W and i dont want all cells in these rows , i only want copy cells under column C,AK,AL,AM (in this order) to my other excel sheet that is named "BigPond" and it should paste it starting from Row5? I want to avoid recording a macro as it selects a range and i am expecting more new rows every week so if a record a macro the cell range for selection changes and i get incorrect result.
View Replies!
View Related
Copy Cells Based On Criteria & Paste Only Values
I am very new to Macro programming. I want to set up a macro which will copy data from few cells in a sheet and paste them as "Values" to certain specific locations in another sheet based on criteria. This copy paste needs to be done for about 40 different cells. I want to fix this with a button on the source sheet, so that this process happens when the button is clicked. I am attaching a sample file showing what I need.
View Replies!
View Related
Average Function Based On Criteria
I'm trying to find the best Macro or Formula to get this done. Sheet 1 has a list of salesperson in column "A" and the total numbers they made on Monday (in the same row, column "E"), Tuesday (In the same row, column "F"), Wednesday (In the same row, column "G"), Thurday (In the same row, column "H"), and Friday (In the same row, column "I"). I also have a sheet for each individual salesperson. I need to find a Macro or a Formula that I can use to give me the average of the numbers if "A5" = the salesperson in Sheet 3 then avarage the numbers from "E5" to "I5" and I want the results to show up in cell "D35".
View Replies!
View Related
Copy Rows Based On Criteria, Paste As Values To New Sheet & Sort
I have spent a few days searching through forums but cannot find examples that i have been able to successfully adapt ( because they are to complicated for my limited knowledge). I have a workbook with 5 sheets, sheet1 (current), and sheet 4 (archive) are the important ones. I need a macro to A) copy rows from "current" to "archive" ( to the 1st empty row) if column S of "current" contains "Closed" ( the word is generated by formula). B) The paste needs to paste special values and number formats ( want to lose formula but not conditional formatting). C) data sort "archives" based on col A - this puts the newly archived data into correct sequence.Data sort lowest number 1st D) delete the copied rows from "current". e) give me a count of how many rows it deleted, (I have a macro to insert rows so will run that manually to recreate the correct number of emtpy rows (with formula and formatting) to bring the current sheet back to usual size. I tried modifying a macro by RPaulson (based on cells on one sheet to cells on another), to work with entire rows but couldn't get it to work. Found that paste special uses PasteSpecial xlPasteValues, but , and thats about it.
View Replies!
View Related
Lookup Data Meeting Criteria
I am trying to include a series of vlookups to find products by a product code from a database, an example is attached. I want to type a code into the box at the top and find the results containting but not uniquely being the input. eg typing 15 in automatically finds 15 using "=VLOOKUP(TRIM($C$6),'Main Database'!1:65536,2,FALSE)" but my database also contains 15eurd and 15rf etc and i want these to appear too. can i do this with vlookups with some clause that excludes a previously chosen entry?
View Replies!
View Related
Lookup Cell Value And Paste
in Sheet1 Col. A i hv some values like 101,102, 103.....9999. In Col. B i have enterd some value In Sheet 2-Col A i have same value but not in same position of Col A of sheet1.and also some values in Col B but different than Sheet1. Now i want to add all values from sheet1 to sheet2 and than delete from sheet1 only of Col. b Exp. IF cell "A1"=101 and if Cell "B1" = 50 in sheet1 than i want the macro for lookup the value of cell A1 of Sheet1 in to the sheet2 range A:A and than to paste value of Cell B1 of sheet 1 into range B:B
View Replies!
View Related
Locate Date Function/Formula Based On Criteria
I am trying to find the starting effective month for a workyear. The criteria for the selected month is that the data BEFORE the effective month is all zeros. I manage to get the result if the data AFTER the effective month is ALL non- zeroes. If there is any zero, the data fetch will be inaccurate due to the COUNTIF formula. Is there any other way or formula that will enable me to get the result. File attached for testing and reference
View Replies!
View Related
Populate Worksheet From Another Based On Criteria
I have a master list of people. (call it master) I have 1 other worksheet that should contain everyone aged 15 and up (call it must progress). One of the columns on the master show's their ages. I was hoping excel would automatically populate the sheet based on the age from the master list. So, for example. On the Master list, Joe Smith is 17. I would like Each cell in the Joe Smith Row to automatically copy itself to the must progress worksheet because his age is over 15. The formula would be based off the age on the master.
View Replies!
View Related
Add Lookup Value In Array Formula To Each Worksheet With VBA
I am looking to write a macro that can look at a value (i.e. "X") in a cell and compare it to the elements in a 2D array (where one dimension corresponds to the start value and the other to the end value) that is found on another worksheet. If "X" falls between the starting and ending numbers then I would like the macro to return a string (say "Test1") to a cell on the same row and a couple of columns to the left. The string values are listed to the left of the start and end values on the first worksheet and are elements to a 1D array. I am trying to make this " loop" through all the cells that contain run numbers (I have highlighted the columns in yellow on the attached workbook). There are multiple (i.e. +12) worksheets in this project but I have only included two in the sample I am providing because of file size.
View Replies!
View Related
|