Copy cell to another sheet if condition is met - excel

I have a sheet with a large data array, which I would like to split into several sheets based on values in a column.
In the main sheet, column "A", I have various labels. On the new sheet, e.g. "LabelX" i need to extract all rows from main sheet, corresponding to "LabelX" value in column "A". There are multiple rows with same label.
Hope it makes sense,
Basic example

It looks as if you want to have your data sorted.
If your columns in your data and in your result are in the same order and you use Office365 this can be done using:
=SORT(FILTER(MainSheet!A:D,A:A<>""))
(Replace MainSheet! with the actual sheet name of your main sheet).
or if you want the results for one particular Label only (for example: Label1) you can loose SORT:
=FILTER(MainSheet!A:D,A:A="Label1").

Related

In excel, how can I automate a sheet to be filled based on conditions of another sheet?

Is there a way in excel to copy the contents of one column to another sheet based on particular values in another column.
I have data which looks like this:
Sheet1:
Sheet2:
I would like to copy the column A of sheet 1 directly onto column A of sheet 2, but only if the value in column B is Y.
I have tried used the match function but am not sure how the best way to do this would be. Is there a way for me to achieve this?
My desired output is:
As discussed in the comments, #Waldorf99 was looking to have a second worksheet that would automatically show a filtered list from the first sheet. I can think of a few ways to do this (array formulas or pivot tables come to mind). The problem with mixing dynamic columns with static values is that the static values would become desynced from the dynamic ones.
In the original example, rows may have a blank value in the condition column in sheet one, and then may be assigned a Y or N at a later date. If a Y is assigned to a row in the middle of other rows, the filtered sheet would shift the existing rows down to make room. The static values would stay where they were, and would become desynced. To demonstrate:
If the above image is the original state of sheet 1 and 2...
...adding a y next to x.1.c would result in sheet two shifting columns A and B of row 2 down, but leaves columns C and D behind (as they are static, and not tied into the first two columns in any way).
One thing that may work as you are wanting are filters. You would only have one sheet, with all of the data manually entered. Then you can add filters, and change them to hide rows temporarily when needed.
To add and use filters:
Start with your data all on one sheet...
Highlight your data...
On the Home tab, select "Format as Table" and choose any style...
This turns your data into a table. You can filter by clicking the drop down in a given columns header row, then deselecting the values you want to hide.
The results are a table that only shows the rows with a 'Y'.
The other rows aren't removed, just hidden. You can always reset or change your filters, to configure which rows are visible.
Note: when working with tables, they will auto expand to account for new rows, so long as you work in the row directly under the table (e.g. don't leave blank rows). You can also manually resize the table at any time by clicking and dragging from the bottom right corner of the table.
There are tons of resources of Excel tables online, and it's a pretty useful tool in Excel.
Hope that achieves what you were looking for.

Return all matches in columns using one criterion (from drop down on another sheet)

I am having two tables, one table (table 1) below is main data, separated into many columns and blocks per 10 rows in one, as you can see A2:A11, A12:A21 and so on (many rows and columns) ... In Column A are unique numbers, but one number per block as a unique, and all other information in other columns can differ, sometimes will be more data sometimes not. The data is always same structured.
What I am looking is to have report / printable sheet where I will have all my columns on one sheet, but in a Column A2 for instance drop down list that will use all unique numbers from main data table and populate all matches on report page, same as it is on picture below. There are many columns that should work automatically when I choose something from "Number" drop down. The trick here is, there must be 10 rows per block also, I have organized it as it should be, but I can't figure out how to populate using functions. So, you can imagine clicking one drop down and getting those lists updated without scrolling endlessly through columns and rows on main data table...
Where I have a problem is that I am getting matches only for first rows but not whole rows (or all rows where matches are) ...
using this function:
=INDEX(Table1[Datum];SMALL(IF(Table1[Nummer]=Printable!$A$2;ROW(Table1[Nummer])-ROW(INDEX(Table1[Nummer];1;1))+1);1))
If someone can help me out, I would be happy!
Try below formula. After putting formula to cell drag down and across as needed. I have tested this formula in Excel2013 and with range (not as table). So, you have to adjust formula for table. I suggest you to first test the formula in single sheet like my screenshot and if it is successful then go for table in Report sheet.
=INDEX(INDEX(B:B,MATCH($G$2,$A:$A,0)):INDEX(B:B,MATCH($G$2,$A:$A,0)+9),ROW(1:1))

How to merge/copy a single column's values in one sheet into another sheet based on the values of a column using excel?

I have two excel spreadsheets (that I can put onto two separate sheets within one sheet, one call A, and one called B).
Spreadsheet A/Or Sheet A
NAME,SPORT
Jordan,Tennis
Jordan,Basketball
Jess,Tennis
Mike,Baseball
Spreadsheet B/Or Sheet B
NAME,AGE
Jorden,5
Jess, 6
Mike, 10
I want to make it so that I can merge the two spreadsheets such that the "Age" column is added to Sheet A with the resulting spreadsheet:
NAME,SPORT,AGE
Jordan,Tennis,5
Jordan,Basketball,5
Jess,Tennis,6
Mike,Baseball,10
How can I do this?
Assume there is an exact match for names in Spreadsheet B to Spreadsheet A (first names only, no need to worry about last names).
Range of values could be variable, but if it's just a matter of making sure the range is updated as new values are put in manually, it's okay. Unless there is a smarter way.
In sheet A, cell C2 :
=INDEX('Sheet B'!$B$2:$B$4,MATCH('Sheet A'!A2,'Sheet B'!$A$2:$A$4,0))
Things to consider :
Is the size of your data variable ? > Do you need to adapt the look up range ?
Will you have duplicates in the names ? > What if two different kids are called "Jordan"

Unique Values in Drop Down List

I have two workbooks, a source file and an output file.
The source file contains information which occupies some drop-down lists in the output file.
For each drop-down list I have two 'names' (in the name manager) linked to it. For instance, the name 'SchemeID' in my output file refers to the same name in my source file. It consists of several rows/columns of data, and that populates my drop-down list.
There are some repeats in the source file (e.g. different names associated with the same number) which are appearing in the drop down lists, and I'd like to get rid of them so the list only displays unique values. Is it possible to do this using data from different workbooks?
The easiest way is oging to be to go to the source workbooks, Data Ribbon -> Remove Duplicates. Anything else will require a couple of in-between data sheets or VBA to do cleanly. If your data doesn't change option this manual method should be fine.
EDIT as you seem restricted from editing the Source File
In a different sheet (let's say Sheet2) you will need a formula which pulls in all of your data from your 2 source Names. To my knowledge there is no clean non-VBA way to combine to Named Ranges, so we will need to do this by dumping the data down to a sheet, and then picking it up again.
There are a lot of ways to do this, but I'm going to pick the one broken down to the most steps; it will be a pretty messy sheet, but you can hide it if you need to, which shouldn't be a huge concern as a non-VBA method will need a data dump sheet anyway.
In Cell D1, we will put the number of rows in SchemeID, as follows:
=ROWS(SchemeID)
In Cell D2, we will put the number of rows in SchemeID2 (which I assume is the name for your second list, which you didn't specify):
=ROWS(SchemeID2)
In column B we will be dumping in the data from both named lists, without sorting or eliminating duplicates. Do this as follows, starting at A1 and dragged down (if you want headers this gets a little trickier, so I will assume no headers).
=IF(ROW()<=$D$1,INDEX(SchemeID,ROW()),INDEX(SchemeID2,ROW()-$D$1)
This says - if the row is not more than the total entries in SchemeID, then pull the value from SchemeID at the current row #. Otherwise, pull the entry from SchemeID2, at the current row# less the total rows in SchemeID (so if we are at row 10, but SchemeID ends at row 4, then row 10 will pull the 6th entry from SchemeID2).
Now in Column A, we will be checking to see which row is a duplicate, as follows starting at A2 [A1 is hardcoded as 1]:
=IF(ISERROR(MATCH(B2,$B$1:B1,0)),A1+1,A1)
This checks to see if there's a duplicate of the current value in column B, in the rows above the current row. If there is, it keeps the same index # as the row above (which will be ignored when we use this as the index key next). If there's no duplicate, it adds 1 to the index number.
In cell D3, put the following formula to track how many unique IDs there are:
=MAX(A:A)
Next, in column C, put your new list, which pulls from column B for as many unique values as there are [drag down]:
=VLOOKUP(ROW(),A:B,0)
This is your new non-duplicate list. To make a clean reference to it, create a new named range with the following formula:
=INDIRECT("'Sheet2!R1C3:R"&'Sheet2!$D$3&"C3", FALSE)
This will simplify to [Assuming 20 rows of data in column C, bsaed on what D3 says]:
='Sheet2!R1C3:R20C3'
Which, in the R1C1 method of referencing, means Sheet2!C1:C20.
This new named range should be what your dropdown lists refer to on your other tab.

Combining Excel sheets/groups of columns by a condition in Excel 2007

Is there a way to combine 2 Excel sheets (or groups of columns inside one Excel sheet) so that the rows in one sheet/group append to the other sheet/group where so that certain columns values match.
To clarify:
Lets say I have 2 sheets - Sheet1 and Sheet2. Sheet1 has the columns A,B,C,D. Sheet2 has columns A,E,F,G. Column A in both sheets contains the same data but differently sorted (it is not sorted in conventional way (alphabetically or numerically)). I need to combine these 2 sheets into one, but they need to be combined so that the values in A column match (if possible the result should be ordered in the same way as the Sheet2).
Ideally, the functionality I'm looking for would need to be like SQL's INNER JOIN command.
I'm using Excel 2007.
Thanks
I think you basically described the VLOOKUP function.
You have your two sheets, now you want to create a list, which extends A,B,C,D to A,B,C,D,E,F,G.
For that, you could just use
Sheet1!E1=VLOOKUP(Sheet1!A1,Sheet2!A:G,5,FALSE)
Sheet1!F1=VLOOKUP(Sheet1!A1,Sheet2!A:G,6,FALSE)
Sheet1!G1=VLOOKUP(Sheet1!A1,Sheet2!A:G,7,FALSE)
If you need to create an extra sheet3 as a result, use this:
Sheet3!A1=Sheet1!A1
Sheet3!B1=VLOOKUP(Sheet3!A1,Sheet1!A:D,2,FALSE)
Sheet3!C1=VLOOKUP(Sheet3!A1,Sheet1!A:D,3,FALSE)
Sheet3!D1=VLOOKUP(Sheet3!A1,Sheet1!A:D,4,FALSE)
Sheet3!E1=VLOOKUP(Sheet3!A1,Sheet2!A:G,5,FALSE)
Sheet3!F1=VLOOKUP(Sheet3!A1,Sheet2!A:G,6,FALSE)
Sheet3!G1=VLOOKUP(Sheet3!A1,Sheet2!A:G,7,FALSE)
Hope this interpretation was correct.
Edit:
By the way, because Excel is not mainly intended to function as a database, this operation is a bit messy, because it does not dynamically scale. At least with the second approach, using a thrid sheet. You will have to copy down A1 at least that far, to match the last used row from Sheet1. And if you should copy it down further, so you won't have to worry about it for a while, you might need to error-proof against the empty cells.

Resources