Cleaning a column from one sheet into another - excel

Sorry if the title is off, but I have no way of making this short.
I have an excel file with 2 sheets: Sheet1 has the first column filled with data, but in a random pattern (ex: 6 consecutive cells are with data, 6 are without, other of the following alternate; basically there is no way of knowing if the next cell has data or not). I want to copy the first column from Sheet1 into Sheet2 without any blank cells or duplicate ones (the order of the data can be maintained or be changed as the result of the formula).
Can this be done without any coding?

Assuming your Sheet1 is as follows
Then in Cell A2 of Sheet2 enter the following formula
=IFERROR(INDEX(Sheet1!A$2:A$50,SMALL(INDEX(NOT(ISBLANK(Sheet1!$A$2:$A$50))*ROW($A$1:$A$49),0),COUNTBLANK(Sheet1!$A$2:$A$50)+ROW($A1))),"")
Drag/Copy down as required. Change range in formula as needed. See image for reference.
EDIT :
To get unique values from Column A of Sheet2 enter below formula in Cell B2 of Sheet2
=IFERROR(INDEX($A$2:$A$20,MATCH(0,INDEX(COUNTIF($B$1:B1,$A$2:$A$20),0,0),0)),"")

Related

Is there a function in Excel which display the same cell value (e.g. client name) several times (as mentioned in another cell)?

Please refer to the picture. I would like to have one formula in the red marked cell (I4) which I can drag-down. I tried several formulas (like ADDRESS, INDIRECT or OFFSET) to kind of work with an array.
I tried the follwoing so far:
In cell I4 I made just the reference to the client name:
=Sheet1!A4
In cell I5 I started working on the formula:
=IF(Sheet1!D4-COUNTA($I$4:I4)>0;I4;ADDRESS(4+(Sheet1!D4-COUNTA($I$4:I4));1;1;FALSE;"Sheet1"))
Your help is much appreciated.
Can be easily achieved with a few helper columns, INDEX and MATCH formulas.
First helper, is a 'First Row' column, in column E (next to your Sum column). In cell E4 add =D4+N(E3) and drag this down for all your Client/Service rows
Then on Sheet2, add a 2nd helper column (Client Row) between your Row column and your Client columns. If Row 1 is in cell A4 on Sheet2, then put =IFERROR(MATCH(A4-1,Sheet1!$E$4:$E$6,1)+1,1) in cell B4, and then drag down.
For your Client column, in cell C4 put =INDEX(Sheet1!$A$4:$A$6,B4) and drag down.
Then when you change your values in your service columns the data on Sheet2 will update. I've assumed that if a client has zero services on Sheet1 you don't want them to appear on Sheet2, so for example if you make Client B 0 for service1 and service2 the your Sheet2 list will just show Client A and C, but with errors after the last client C row. Some error handling can be built into the formulas to deal with this if you want.
There should be other/easier ways to do it. But this is my approach.
Suggestion: Solve this kind of problems by breaking them in smaller steps.
Setup:
Formulas per column:
How many times (previous cell): =IFNA(VLOOKUP(H3;$A$4:$B$6;2;FALSE);0)
Count appearances in result (previous cell): =COUNTIF(H$3:H3;H3)+1
Find changes: =IF(E4-D4>0;1;0)
Sum changes: =SUM(F$3:F3)
Result: =IF(IF(F4=1;OFFSET($A$4;G4;0);H3)<>0;IF(F4=1;OFFSET($A$4;G4;0);H3);"")
Drag the formulas down
In Sheet2 I4, formula copied down :
=LOOKUP(ROW(Sheet1!A1),SUBTOTAL(9,OFFSET(Sheet1!$D$3,,,ROW(Sheet1!$A$1:$A$4)))+1,Sheet1!A$4:A$6)&""

Refer the same cell after applying filter in Excel

I have the following situation:
Sheet1
and Sheet2
In sheet 2 cell B1 is equals to Sheet1!B2 and it does not changes when I apply the filter in sheet one. Is there a way to set the filter on first sheet on the "C" and let the cell on the second sheet show 156566?
Can you put a helper column in Sheet1?
If so, add this a formula to Sheet!C1
=ROW()
and copy down for all data rows. Hide this column if you wish
Now, Formula for Sheet2!B1 is
=INDEX(Sheet1!$B:$B,AGGREGATE(15,5,Sheet1!$C:$C,2))
Filtering only hides the row, so Row2 is still technically "154221".
I found this solution using formulas to return the first visible cell in a row:
Find Value of First Visible Cell
Change your formula on Sheet 2 to the following and then hit Ctrl+Shift+Enter to apply the formula as an array:
=INDEX(Sheet1!B2:B5,MIN(IF(SUBTOTAL(3,OFFSET(Sheet1!B2,ROW(Sheet1!B2:B5)-ROW(Sheet1!B2),0)),ROW(Sheet1!B2:B5)-ROW(Sheet1!B2)+1)))
Note this will give the first visible cell on Sheet1 within the range of B2:B5. If you add more rows, you will need to update the range. There may be a more elegant way to handle that.

Excel categorize list transfer

I'm trying to create a summarize information for all of the supplier our company have. I have my sheet1 as my main database where in all our suppliers are listed. I would like to create several additional sheets which will contain each specific nature of business of the suppliers.
What I would like to happen is, given that my sheet2 is for the suppliers who specialize in "PRINTING", sheet3 is for those who specialize in "I.T EQUIPMENT". Whenever I add a supplier on my sheet1, it will automatically be added on my sheet2 or 3 as well if it matches its specialty. Please help!
Thank you in advance!
Considering your Sheet1 is Master Sheet where names of all Suppliers and their Specialties are listed in Column A and Column B respectively.
If in Sheet2 you want to list down the all Suppliers with Printing as specialty, write following formula in Cell A2 of Sheet2
=IFERROR(INDEX(Sheet1!A$2:A$25,SMALL(IF(Sheet1!B$2:B$25="Printing",ROW(A$2:A$25)-ROW(A$2)+1),ROWS(A$2:A2))),"")
and drag/copy it down as required. This is an array formula so enter this formula by pressing Ctrl+Shift+Enter.
Likewise, if in Sheet3 you want to list down all Suppliers with IT Equipment as specialty, write following formula in Cell A2 of Sheet3
=IFERROR(INDEX(Sheet1!A$2:A$25,SMALL(IF(Sheet1!B$2:B$25="IT Equipment",ROW(A$2:A$25)-ROW(A$2)+1),ROWS(A$2:A2))),"")
and drag/copy it down as required. Again, this is an array formula so enter this formula by pressing Ctrl+Shift+Enter.
To automatically update the list in Sheet2 and Sheet3, you'll have to take care of two things:
1. Range in the above formula is row 2 to row 25, you'll have to enter the range till the row you think your list could be extended. For example if your list will not get past the row 1000 then formula for Printing in Sheet2 becomes
=IFERROR(INDEX(Sheet1!A$2:A$1000,SMALL(IF(Sheet1!B$2:B$100="Printing",ROW(A$2:A$1000)-ROW(A$2)+1),ROWS(A$2:A2))),"")
2. You'll have to drag/copy down this formula in Sheet2 and Sheet3 till the row you think the list could extend based on the Sheet1 data.
You can even use just one formula for all the sheets as follows:
=IFERROR(INDEX(Sheet1!A$2:A$25,SMALL(IF(Sheet1!B$2:B$25=$C$1,ROW(A$2:A$25)-ROW(A$2)+1),ROWS(A$2:A2))),"")
where Cell C1 of each sheet will have the specialty name.
See image for reference

Excel function that copies rows if they fall within the range of 2 dates

So at the top of my Excel sheet I have 2 cells, A2 and B2, where people can enter a starting and ending date.
On a seperate sheet I have an enormous list of starting and ending dates in columns A and B, and corresponding data for each of these 'events' in columns D through G. I need my function to copy all rows where the starting date falls between the two specified dates, and copy the data to the first sheet, in cells A4 - G4 through A100 - G100. (I just chose 100 as a large number, to make sure the area where the data gets placed is large enough)
I'm guessing this function I need includes the INDEX function, but I only know how to use it to look up one data cell at a time, not how to copy an entire range of cells.
Can anyone help?
No helper columns required.
Enter this formula into cell A4:
=IFERROR(INDEX(data!D$2:D$9999,SMALL(IF((data!$A$2:$A$9999>=$A$2)*(data!$A$2:$A$9999<=$B$2),ROW(data!$D$2:$D$9999),9E+99),ROW(1:1))-1),"")
This is an array formula and must be confirmed with Ctrl+Shift+Enter.
Now copy the formula to the range B4:D4.
Now copy the A4:D4 to the range A5:D100.
That's it.
Let's say Column C in the data sheet is blank, and free to add a formula.
Let's also assume that the data begins in row 2.
Then the following formula can be put in C2 & copied down:
=IF(AND(A2>=Sheet1!$A$2,B2<=Sheet1!$B$2),C1+1,C1)
Basically it is saying that if the beginning date of the current record is greater than or equal to the date the user is looking for, and the ending date is likewise within range, iterate the record, otherwise not.
At this point the user sheet can have a simple VlookUp as follows:
In D1: =VLOOKUP(ROW($A1),Sheet2!$C:$G,COLUMN(B$1),0)
Copy this across to G and down however many rows you like.

Merge two Excel tables Based on matching data in Columns

I've been working on a excel problem, that I need to find an answer for I'll explain it below.
I've Table01 with the Columns :
Group No
Name
Price
I've Table02 with the columns:
Group No
City
Code
I've merged two tables of Table01 & Table02 as shown in the Image03 , But without order.
But,as you see Group No Column is similar in both tables.
What I need is to get the matching rows of Table01 & 02 considering 'Group No' Column.
The Final result is to be seen as the final image.
Is there a way to do this with excel functions ?
Thank You!
Put the table in the second image on Sheet2, columns D to F.
In Sheet1, cell D2 use the formula
=iferror(vlookup($A2,Sheet2!$D$1:$F$100,column(A1),false),"")
copy across and down.
Edit: here is a picture. The data is in two sheets. On Sheet1, enter the formula into cell D2. Then copy the formula across to F2 and then down as many rows as you need.
Teylyn's answer worked great for me, but I had to modify it a bit to get proper results. I want to provide an extended explanation for whoever would need it.
My setup was as follows:
Sheet1: full data of 2014
Sheet2: updated rows for 2015 in A1:D50,
sorted by first column
Sheet3: merged rows
My data does not have a header row
I put the following formula in cell A1 of Sheet3:
=iferror(vlookup(Sheet1!A$1;Sheet2!$A$1:$D$50;column(A1);false);Sheet1!A1)
Read this as follows: Take the value of the first column in Sheet1 (old data). Look up in Sheet2 (updated rows). If present, output the value from the indicated column in Sheet2. On error, output the value for the current column of Sheet1.
Notes:
In my version of the formula, ";" is used as parameter separator instead of ",". That is because I am located in Europe and we use the "," as decimal separator. Change ";" back to "," if you live in a country where "." is the decimal separator.
A$1: means always take column 1 when copying the formula to a cell in a different column. $A$1 means: always take the exact cell A1, even when copying the formula to a different row or column.
After pasting the formula in A1, I extended the range to columns B, C, etc., until the full width of my table was reached. Because of the $-signs used, this gives the following formula's in cells B1, C1, etc.:
=IFERROR(VLOOKUP('Sheet1'!$A1;'Sheet2'!$A$1:$D$50;COLUMN(B1);FALSE);'Sheet1'!B1)
=IFERROR(VLOOKUP('Sheet1'!$A1;'Sheet2'!$A$1:$D$50;COLUMN(C1);FALSE);'Sheet1'!C1)
and so forth. Note that the lookup is still done in the first column. This is because VLOOKUP needs the lookup data to be sorted on the column where the lookup is done. The output column is however the column where the formula is pasted.
Next, select a rectangle in Sheet 3 starting at A1 and having the size of the data in Sheet1 (same number of rows and columns). Press Ctrl-D to copy the formulas of the first row to all selected cells.
Cells A2, A3, etc. will get these formulas:
=IFERROR(VLOOKUP('Sheet1'!$A2;'Sheet2'!$A$1:$D$50;COLUMN(A2);FALSE);'Sheet1'!A2)
=IFERROR(VLOOKUP('Sheet1'!$A3;'Sheet2'!$A$1:$D$50;COLUMN(A3);FALSE);'Sheet1'!A3)
Because of the use of $-signs, the lookup area is constant, but input data is used from the current row.

Resources