Excel table fill every third row - excel

I need help with issue I'm having.
I got 2 sheets, 1st sheet is the table I need to fill and 2nd one is the data.
In the data part I have column A with employee number and B with names.
On the first sheet I have table that I need to fill but table is like this:
Blank row
Number column + Name column
Blank row
So when I just drag data to auto fill every third row formula skips employees and I only get every third name.
What can I do to fill every third row from 2nd sheet but without skipping names?

Kind of round about way that I have done it. On datasheet insert column a and put in values A1(1)A2(3)A3(5), Fill down this pattern this is to use as an index for filling the columns on your other sheet. On the sheet you are filling, insert a new column a and add 1,2,3 and fill down.
I used this vlookup:
=IFERROR(VLOOKUP(A1,datasheet!A:C,2,FALSE),"")
I copy this to column b and fill both of these columns down. Now you have your values. You will have to do a copy and paste values to get rid of the formulas once the info is in there. Select all, copy. and Ctrl+Alt+V and select values to do the paste special.
Hope this helps.

Related

Fill dates array and add dummy variables

I have a column with dates called "dates". This column contain dates from 01.01.2010 to 31.12.2010. it should have about 365 rows, but it actually has only 231 rows, because the data was not collected regularly. The others are missing, and I'd like to fill the gaps in time.
How can I fill the array of this column with the missing dates? I want to add 134 rows in the place of the missing ones, filling in the missing dates.
Create another sheet and put all the dates in column A in your new sheet.
Make sure your sheet with the data in it has the data column all the way on the left (important for how Vlookup works)
In your new sheet, starting in Cell B2 put numbers 1 through however many columns you have in your data sheet along that top row.
In your new sheet use Vlookup to find all the rows where there are data
=VLOOKUP($A2,DataSheet!$A$1:$C$20,B1,FALSE)
Note that the lookup column ($A1) is locked in to the column but not the row and that the range you are looking up is locked in in all directions. This will allow you to drag to the right/down and fill everything in.
Drag to the right then drag all the way down.
there will be #N/As where you cannot find a match which you can suppress with either an IF statement of conditional formatting. But now you have a row for every day with blanks when there is not data!
I found a solution with a similar formula, but the result was the same.
First, I got the two columns of data—"date" and "values" in the columns A and B of the worksheet. Each consisted of 231 rows. Then, I spread a full array of dates—365 in a new column D. Finally, I used this formula:
=VLOOKUP(D2;$A$2:$B$1056;2;FALSE)
in C2 and obtained the only the values from column "values" corresponded to the new dates of column D.
Thanks for Brad's answer for directing me to the VLOOKUP function.

Trying to select rows that matched in vlookup excel

I am trying to select the rows of the results from my VLOOKUP and put the results in a neat table in another sheet. The row in my "M" column has a lot of NA and random numbers that were matched.
See this image for clarification:
I want to select all the rows that returned a result and move those rows to another sheet in a table without blank rows between the results. I am not sure how to do this but I know a resident stackoverflow pro probably thinks this is cake. Thanks for the help in advance!
You could make use of a filter:
Select your table and put a filter (under Home tab, Sort & Filter).
Uncheck the #N/A in the selection filter (click the little grey box with black arrow for the column where there are the #N/A that appeared when you inserted the filters).
Copy and paste everything you need into the other sheet.
You can do this with some formulas:
In the column next to your VLOOKUP (I assume it's column C) place a 'counter formula'- in D2, place =IF(ISERROR(C2),0,1), in D3 and below: =IF(ISERROR(C3),D2,D2+1)
Create a new table (say in starting in column F in the same sheet)
In the first column of the table, just place increasing numbers (e.g. in F2: =ROW()-1)
In the next columns, use INDEX/MATCH to retrieve the results, e.g. in G2: =INDEX(A:A,MATCH(F2,D:D,0))
Done!

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

Copy paste line items in Sheet B to filtered rows in Sheet A in Excel?

I have Sheet A with 500 line items.
Suppose I have applied filter to show line items "2","44","68" and so on
From Another Sheet i want to select some rows and paste them in these filtered rows.If I paste,they get copied on line items 2,3,4,5, and so one instead of 2,44,68,etc
Can Someone please help me.I tried paste special,but it has same issue.
I also tried selecting the area to paste,then clicking alt + ; but the data also gets copied into unfiltered items.
This is more of an approach solution then a coding solution. I assume that the current order of the rows must be maintained.
Add a column to to your sheet, use autocomplete to number the current order of the rows.
Sort by your filter value(s) - if you have multiple values, just add another column and put a single unique value in it
Paste your values
Sort by you current order column, to restore the orginal order
If it is with same sheet you can make the two columns adjacent by hiding other columns in between. You can block the data and drag it to next column.
For eg.
I have column A, B, C, D.
Let A be ZIP CODE & Column D is 'Shipping Service'
I need to have ZIP CODE(Column A) with '95035' to have Shipping Service as 'Fedex'
Filter the column A with '95035'
Hide the column B & C
Drag the values from A to D directly where the values are copied to the adjacent cells.
Note: If you use two separate sheets copy the columns entirely to the sheet 1 adjacent to the column you want to copy and again take copy the entire column back to Sheet 2. This will work if both sheet have same number of rows.
Thanks,
Karthik
The easiest coding solution is to use vlookup http://office.microsoft.com/en-us/excel-help/vlookup-HP005209335.aspx
On sheet1 from Sheet2 use
=VLOOKUP(B3,Sheet2!A:B,2,FALSE)

How to automate a spreadsheet

I am using microsoft excel 2002. What I am wanting to do is say I have some data in column A in sheet 1 and data in column A in sheet 2.
What I want to do is when I add data to sheet 1 Column A (lets say some text), I want excel to automatically add a row in sheet 2 column A. So if I have 30 rows in both sheets and I add a string "hello" in sheet 1 Column A (in row 31), I want it to automatically add the same row in sheet 2 Column A (row 31).
Is this possible to do from within excel?
Thanks in advance for your help.
In column Sheet 2 , column A row 1
enter the formula '='Sheet 1'!A1
Then cntrl C the cell with the formula you just entered,
Still in Sheet 2 select cells A2 to A99 or however many columns you expect to enter
cntrl V
The values you enter in Sheet1 will magically appear in sheet2
You can do this easy in VBA. If getting started is hard for you, record a macro and check out the generated code. You'll have no problem continuing from there.
Good luck!
you could put an Array formula in Sheet2 Column A. I dont think you can get this to work on the entire column, but you could apply it to say the first 5000 rows. Then when the user enters values on Sheet1 they would be duplicated on Sheet2.
Somthing like:
=IF(Sheet1!$A$1:$A$5000="","",Sheet1!$A$1:$A$5000)
Should copy the cells from A1:A5000 and remove the empty ones into the destination range. You will need to select the 5000 cells on Sheet2 and enter the formula and then press Ctrl-Enter to insert it as an array formula.
This is far simpler than attempting to build something either with VBA or VSTO to watch for changes and duplicate them.

Resources