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!
Related
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.
i want to delete complete row in excel if the value in A column in NULL (i mean empty).
is there any simple query which can do this ?
please don't say some filter way... :( they won't work for me :( if there is any EXCEL FORMULA please help me know friends...
A B C D E
10 20 ADE
56 AE A4 A76
4 EE AS EWS
45 SS EE
i want to delete the 1st and 4th row as column A rows are empty...
Try this:
Put a formula in cell F1: IF(A1="","",ROW())
Fill down the whole of column F. This should give you consecutive numbers, or blanks where column A is blank.
Select all of column F, Copy, then Paste special... values only. This will stop the numbers changing when you do step 4.
Select the whole table and sort by column F. This will put the rows you don't want at the bottom, where you can delete, hide or ignore them.
Delete column F once you're done.
Either
Highlight the whole area
Choose the Home tab, Sort & Filter, Custom Sort
Uncheck the option My data has headers
Choose to sort by column A in ascending order
The blanks will be at the bottom and you can delete this block
Note that this approach will not retain the original order, the following will:
Highlight from A1 downwards, to the end of the data
Choose the Home tab, Find & Select, Go To Special
Select the Blanks option; this will select all blank cells in this column
From the Home tab, Cells Group, choose to Delete Sheet Rows
If there are a lot of cells in column A then start by scrolling to the last cell; click in this cell and press Ctrl-Shift-Home to select all cells up to A1.
It can also be achieved with filtering, but a formula cannot delete rows.
Select the column you want to detect the blank rows in, go to Sort & filter and select filter. You will now see this column has a drop down box, click on this and go to the very bottom and untick the box called 'blanks'. this will now automatically hide the rows which contain blanks.
If you need to use the data in this format just copy and past it into a new worksheet using paste values as I am unsure how programs would it.
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 ;)
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)
I need a formula that is beyond me and my Excel skills, I need to insert the number of times a match is found in column A into column C and then insert the total number of days for that person in column D. Can anyone help?
In cell C2:
=COUNTIF(A$2:A$6,A2)
In cell D2:
=SUMIF(A$2:A$6,A2,B$2:B$6)
See also:
COUNTIF
SUMIF
Have you considered using a pivot table? It's a little bit overkill but greatly simplifies what you want to do. Assuming your using Excel 2007:
Select the range of data including column labels.
Go to Insert->[Tables]->PivotTable.
In the dialog box that appears, select Existing Worksheet, choose a cell a click OK.
At this point, the PivotTable pane appears with your field names in one box and four other labeled boxes below.
Drag Name to the Row Labels box.
Drag Name to the Values box.
Drag Days to the Values box.
You're done!