Excel formula - copy everyother row from 2 sheets - excel

I know how to use a formula to reference in text from other sheet however, when dragging along its picking up each column by sequence, I need this to be able to copy over every other 1. I.E. B19,D19,F19,H19,J19... ETC.
Can anyone help?

to get the pattern use INDEX()
=INDEX('Initial data sheet'!19:19,(COLUMN(A:A)-1)*2+2)
This will start in B19 and move over two columns for every column it is dragged over.
The *2 is the spacing.
The +2 is the starting column.

Related

Copy the first cell of column and copy into a new column in front of each row and loop through after blank

I have data in an excel sheet with a name on the top and below is the date in the same column. The next columns are some numbers that I want to add with respect to the name on the top and date.
What I needed is just to copy that name in front of each row, so I can use formulas. There are hundreds of rows with blanks after a total of every name.
10_xxxxxxxxxx_150858
04/01/2019 5
04/04/2019 6
04/05/2019 3
04/07/2019 2
04/08/2019 1
Probably a screenshot and a bit more details on the need would be useful but I think you can achieve what you want by using the '$'.
When you extend a formula it allows indicating which part of the formula should stay unchanged.
Example:
=$A1
If you extend this formula to the right, it will always refer to column A.
If you extend it down, the line number will increase but refer to column A is fixed.
In your case, something as follow could be useful:
=$A$1

How do I sort a table that is referenced by another table?

I have this table that is made from reference to other table.
and now I want to sort from small to largest the third column, but since it is referenced from another table is not sorting. And I also dont want excel to sort the reference table and I need the table to be referenced because I will change some values on the reference table and I need them to be connected, so I just cant copy and paste the values and then sort.
Could you give me some help?
Ok, I went ahead and built a small example:
The formulas are as follows:
The 3 in Row 20 are to be copied downwards with PasteSpecial>Formulas:
in E20: =IFERROR(RANK($D20,$D$20:$D$33,1),"")
in F20: =IF(ISNUMBER($D20),"",(COUNTIF($D$20:$D$33,"<"&$D20)+1)+COUNTIF($D$20:$D20,$D20)-1)
in G20: =IF($E20="",(MAX($E$20:$E$33)+$F20),$E20)
The formula in B3 is to be copied into the whole target table with PasteSpecial>Formulas:
in B2: =INDEX(B$20:B$33,MATCH(ROW()-1,$G$20:$G$33,0),1)
Please let me know if you have any questions!
This method only works if the entries in the column you are sorting on are unique. You will need to adjust the address ranges to suit your data.
The formulas in the each column start from X and finishing in Z as you move left are as follows:
=INDEX($X$41:$X$47,MATCH(ROWS($Z$29:Z29),COUNTIF($Z$41:$Z$47,"<="&$Z$41:$Z$47),0))
=INDEX($Y$41:$Y$47,MATCH(ROWS($Z$29:Z29),COUNTIF($Z$41:$Z$47,"<="&$Z$41:$Z$47),0))
=INDEX($Z$41:$Z$47,MATCH(ROWS($Z$29:Z29),COUNTIF($Z$41:$Z$47,"<="&$Z$41:$Z$47),0))
Note only the range right after INDEX is changing. Thes are CSE or array formulas. It means you need to press CONTROL+SHIFT+ENTER when you are done editing your cell. Then copy the individual cell and paste it in the rows below the copied cell. pasting including the source cell or dragging down MAY not work. Repeat this for all three columns.
Proof of concept

Expanding an Excel formula without referencing the previous cell

I am attempting to use an IF statement to check whether the sum of two cells from another Excel sheet is greater than or equal to 1.
For a sheet called Test1 with the values of interest in column C, this is what I have so far, which works fine:
=IF((Test1!C1+Test1!C2>=1),1,0)
In column B on a second sheet that I'll call Test2, I want to copy this formula down 200,000 rows. However, if the aforementioned formula is in cell B1, for the formula in B2 I would like the formula to read:
=IF((Test1!C3+Test1!C4>=1),1,0)
I want to copy the formula down the column so that the second cell reference in the formula in the first row does not become the first cell reference in the formula in the second row (eg. it would go C1+C2, then C3+C4, C5+C6, etc.).
I have tried manually entering the formula for a few rows, highlighting those, and copying them down but can't get the desired cell reference pattern. If I highlight and drag these first three formulae down another three rows, C4 and C5 are repeated and not in the correct pair.
=IF((Test1!C1+Test1!C2>=1),1,0)
=IF((Test1!C3+Test1!C4>=1),1,0)
=IF((Test1!C5+Test1!C6>=1),1,0)
=IF((Test1!C4+Test1!C5>=1),1,0)
=IF((Test1!C6+Test1!C7>=1),1,0)
=IF((Test1!C8+Test1!C9>=1),1,0)
I have tried using OFFSET() within this formula but couldn't get it to work. I am basically just wanting to add 1 to each of the cell references in the formula, as compared to the previous row (but not to actually add 1 to the value of that cell, as would happen with C1+1 for example).
Any insight would be greatly appreciated!
If you plan on copying this down 200K rows then you will want the absolute simplest formula that accomplishes the stagger. Avoid the volatile OFFSET function or be prepared to spend a lot of time waiting for random calculation cycles to complete. A volatile function will recalculate whenever anything in the workbook changes; not just when something changes that involved the formula in the cell.
=--(SUM(INDEX(Test1!C:C, (ROW(1:1)-1)*2+1), INDEX(Test1!C:C, (ROW(1:1)-1)*2+2))>=1)
The following formula should do the trick:
=(SUM(INDIRECT("C"&ROW()*2-1);INDIRECT("C"&ROW()*2))>=1)*1
And that's the version using IF:
=IF(SUM(INDIRECT("C"&ZEILE()*2-1);INDIRECT("C"&ROW()*2))>=1;1;0)
You say I am basically just wanting to add '1' to each of the cell references in the formula but appear to be incrementing by 2, so I am confused but an option might be to apply you existing formula to 400,000 rows, together with =ISODD(ROW()) in another column, then filter on that other column to select and delete those showing FALSE.
Excel's autofill won't do the 2-cell shift that you're looking for. You can use the functionality that is there.
Put =IF((Test1!C1+Test1!C2>=1),1,0) in the top cell and drag a copy to the second row (it will be =IF((Test1!C2+Test1!C3>=1),1,0) but that's okay). Now, put 'A' and 'B' in the next column. Select all 4 cells and copy them down 400k rows.
Use filter to delete rows flagged with 'B' and delete the blank rows.
(Select blank rows with [F5] click Special and select Blanks, then right-click and delete)
Here is all you need. It's fast and nonvolatile.
=--(SUM(INDEX(Test1!C:C,ROW(1:1)*2-2):INDEX(Test1!C:C,ROW(2:2)*2-2))>=1)
Copy it down as far as you like.

Copy formula down column, but skipping a row here and there

So I have a formula that pulls data from another sheet and sums it. I want to pull this formula down the column, but I need to skip every eighth row. I need the formula to only increment by one as it jumps this row. Is there a quick way to accomplish this?
EDIT: To clarify, if cell A7 has formula =SUM(C3,H3) then I need A8 to be empty and A9 to be =SUM(C4,H4)
You could use - IF(MOD(ROW(),8) to identify the 8th row and do a different action i.e make it blank. Without seeing the formula its hard to know how this would effect your increments
If you are needing to have a moving sum to account for the empty spaces - this (or something along these lines) should work:
=IF(MOD(ROW(),8)=0,"",SUM(INDIRECT("B"&ROW()-ROUNDDOWN(ROW()/8,0)),INDIRECT("G"&ROW()-ROUNDDOWN(ROW()/8,0))))

Excel: Agregate multiple tables separated by title

I have an excel file generated by SAP. I need change its format from multiple tables separated by a title to one single table. This is the original table:
and i need it to look like this:
Im new to excel, so i dont have a clue how to do it.
I cant do it manually becuase the file has 5000+ rows.
Any guidance?
I usually use the generic formula:
=IF(XX="",YY,XX/ZZ)
Where XX is a cell you can use to identify a header to append to the individual transactions and YY is the cell directly above the cell you have put your formula. XX is when you need that value itself, ZZ is another value. You'll understand when you apply it.
For instance, here, you could use cell D5 to do this. I would insert two columns before column D (the value of cell D5 is now in cell F5), and put this formula in cell C5:
=IF(F5="",C4,B5)
I will then fill the formula down. This carries the Material ID everywhere down to the last row. There are two quick ways to do this in a file of this type:
Copy the formula, scroll to the bottom of the sheet, hold Shift and click the last cell in the column, then paste.
Select the cell containing the formula, scroll to the bottom of the sheet, hold Shift and do Ctrl + ,D.
In cell D5, I would put the formula:
=IF(F5="",D4,F5)
And fill it down as well to get the material description.
Now for the size per unit, you can create a column to the right of column K (column K now has 'Size per Unit' since we inserted two columns earlier), and put this formula in cell L6:
=IF(K6="",L5,K6)
Fill it down to get it everywhere.
Now, to finish it up, select the whole sheet and copy/paste values (Paste Special > Paste Values) to remove the formulae. Delete rows 1 and 2, put a filter and sort by a field such as the column 'Metric'. Go to the bottom and delete the no longer needed rows.
As a bonus, if you need to make absolutely sure that the order of the transactions is the same as initially, insert a column somewhere, put sequential numbers into it; that is the first cell in the column has 1, the second 2, then 3 etc and fill to the bottom. Be sure that it is in the filter when you delete the unneeded rows, and sort by this column when you are done.
5000+ rows is still good though, I've had to deal with 10+ workbooks each with ~90000 rows once ;)

Resources