I have two sheets in my spreadsheet and I'm looking for some VBA code (or a simple formula) to batch copy values from one sheet into the other.
Sheet1, has a list of cities, markets and products in three columns (A-C). Close to 19,000 rows in total.
Sheet2, has a list of products, product sub-category, and product origin (columns A-C), Close to 300 rows in total.
I would like to copy product sub-category and product origin (i.e. columns B and C in Sheet2) into Sheet1 where Product in Column C of Sheet1 = Product in Column A of Sheet2. Noting that I would like to keep the order that the rows are in Sheet2 when copying to Sheet1.
I tried the following INDEX/MATCH approach, but it stops working after the 18th row (I have close to 19,000 rows in Sheet1), and it only works for one column at a time.
=IFERROR(INDEX('Sheet2'!$B$2:$B$284, SMALL(IF($D2='Sheet2'!$B$2:$B$284, ROW('Sheet2'!$B$2:$B$284)-1,""), ROW()-1)),"")
Example output using the sample data:
if it is just copying static data repeatedly then perhaps something like this. If not, then i misunderstood your question.
this is the formula in cell B2:
=INDEX(Copy.Table,IF(MOD(ROW()-ROW($B$1),Table.Count)=0,$E$2,MOD(ROW()-ROW($B$1),Table.Count)))
Related
My goal is to enter in column E on sheet 2 whether or not the customer used the discount code "BUNDLE3".
I would like to look at the order number in sheet 2 represented by column A then look at Column A in sheet 1 (where my orders data is) and if they match, then look at column M(discount code column in sheet 1) and if Column M has the text "BUNDLE3" then return Yes, if not return No.
The formula I was using is the one below, where orders_export_1 is sheet 1. It doesn't work because its not looking at the order numbers at all.
=IF(ISNUMBER(SEARCH("BUNDLE3",orders_export_1!M2)), "Yes", "No")
Please refer to image links for more clarity.
sheet 2, where I am trying to use an excel function in order to find out if an order (represented by column A) used the discount code "BUNDLE3"
sheet 1, This is my orders data. Sometimes orders take up multiple rows since they are listing the products customers have purchased.
In Sheet2, E2, put this formula and drag down:
=IF(COUNTIFS(orders_export_1!$A$2:$A$100,A2,orders_export_1!$M$2:$M$100,"BUNDLE3"),"Yes","No")
Adjust the range on orders_export_1 as needed.
I am currently working with 3 sheets in excel. They are called Sheet1, Sheet2, and Summary. In Sheet1 and Sheet2, I have a list of states with a column for revenue. In the Summary sheet, I want to do an SUMIF statement as if the state in Summary is in Sheet 1 and 2, then I would like to add both revenue amounts together. So if the state of PA was in the Summary page, and it showed up in Sheet1 and Sheet2 then I would like to add both cells together. Now if it showed up in just Sheet1, I would still like to have it add it to the Summary page as it should be just adding a 0 since it is not in Sheet2. Any help with this would be great. I have used COUNTIFs before but I cannot seem to get this to work correctly. Thanks!
Demo
I assumed few things here:
Assumptions:
Sheet1 has state names in Column C and corresponding revenue in Column D
Sheet2 has state names in Column C and corresponding revenue in Column D
Summary sheet has state name in cell C6 and you want to see the total revenue of states (from sheet1 and sheet 2) in column D of Summary sheet.
To do this use this formula in cell D6 of Summary sheet. You may need to modify the range of table which i assumed "C4:D5". It may be different for you.
=IF(ISERROR(VLOOKUP(C6,Sheet1!C4:D5,2,FALSE)),0,VLOOKUP(C6,Sheet1!C4:D5,2,FALSE))+IF(ISERROR(VLOOKUP(C6,Sheet2!C4:D5,2,FALSE)),0,VLOOKUP(C6,Sheet2!C4:D5,2,FALSE))
Based on more description here is the updated formula:
SUMIF(Sheet1!$B$3:$D$11,Summary!C3,Sheet1!$D$3:$D$11)+SUMIF(Sheet2!$A$3:$B$11,Summary!C3,Sheet2!$B$3:$B$11)
I have a workbook with 7 sheets containing part number of a product in column and its cost in adjacent column. And the 7th sheet contains total number of parts in all the sheets. I want to change cost of some products but then I have to do the same in all sheets. Is there a way by which it automatically finds and changes cost in individual sheets when i change it in the sheet containing total?
Use VLOOKUP on the first 6 sheets to match the price to each part number.
So, in each "cost" column on the first 6 sheets, enter this formula (assuming Cost on Sheet7 is still in column C):
=IFERROR(IF($A1="","",VLOOKUP($A1,Sheet7!$A:$C,3,FALSE)),"")
If you have header row(s) then just replace the two instances of $A1 in the formula with whatever the first row of data is (e.g. $A2), paste the formula into that row in column C on Sheet1, then drag-copy the formula down as far as you want. Repeat for sheets 2-6.
I have two sheets. Sheet1 has a list of products and Sheet2 has a list of products and their location. Since the product can be in multiple locations, there are a good amount of duplicates in Sheet2.
There are 26,000 products. I have assigned each product a number in Sheet1, 1-26,000. Is there a way for me to assign each number to the correct product in Sheet2?
This is a example of what I need:
The top table would be Sheet1 and the bottom table would be Sheet2, the one with duplicates.
This is what they look like right now:
Sheet1:
Sheet2:
Please let me know if I did not explain this well enough. I appreciate your help!
copy your column A in sheet 1 to column c
Then in your sheet 2 column C row 2, use =vlookup(B2,'sheet1'!B:C,2,0)
(if your first item is in B2)
Drag your formula down and it should work.
Use VLOOKUP or the INDEX MATCH combo formulas in the second sheet to locate the ITEM IDs in the first worksheet
If you're Item ID's are sorted the way you illustrate it, then you can simply use an IF formula:
For example you have a data as shown:
Enter this formula in A2:
=IF(B2=B1,IF(ISNUMBER(A1),A1,1),IF(ISNUMBER(A1),A1+1,1))
Above formula will give you what you've described.
Again, your items should be sorted so that same Item ID are in order.
I will to try to explain this as best as I can.
I have 2 sheets:
- Sheet 1
- Sheet 2
Sheet 1 has a lot of rows with information, name, address.. ads etc.
The important one is "Ads". You can Select, Yes, No or Maybe via dropdown.
If the user selects YES on sheet 1, on the "Ads" column the the information in the SELECTED columns will be referenced to sheet 2 assuming you have "Yes" in the "ads" column.
I can use the IF statement, if ROW 2,3,4, state yes and row 5,6 states NO and row 7 states yes.
Then on sheet 2, there will be 2 rows that are not populated, so I would like to get rid of the 2 rows to make things look nicer.
I would also like to states that on Sheet 2, there will be extra information for the ads, such as time, date, locate etc etc.
I am not sure if there has to be a macro.
I hope this is clear , please as anything which you make need to know
Thank you
Updated:
In sheet 2 Column b,c,d etc... I will put NEW information about connected to column A in sheet two. How if I change a old Yes to No in sheet 1 regarding ads. the rows adjust in Sheet 2, but one column A, no b nor c etc. So you looses the preservation of the data. Any solution around that. – Arthor 2 days ago
One way with no array formulas, just uses a "helper column" off to the right on sheet1, the same sheet you're selecting ADS = yes/no on.
Let's assume column Z is empty.
Let's assume the "ADS" column is column M.
In Z2, put this formula: =IF(M2="Yes", N(Z1)+1, N(Z1))
Copy that cell down column Z to the bottom of the data set. The result is an "index" where you can spot the "YES" rows based on when the index number increase by one. Now let's use the index.
On Sheet2, put this formula in A2: =IF(ROW(A1)>MAX(Sheet1!$Z:$Z), "", INDEX(Sheet1!A:A, MATCH(ROW(A1), Sheet1!$Z:$Z, 0))
The first column A value from sheet1 where "yes" is in the ADS column. Now copy that cell to the right to get the rest of the values from that row to appear.
Now copy that set of cells down and across the sheet2 table to get your values to appear. You can copy down a ways and the values will go blank when it runs out of "yes" rows.
This will not only display all the yes rows, it will display them in the same order they are on sheet1.