I have 2 tables on the same sheet. The first table "Rank" has values in column 1 (or column A) and rows 2 through 8.
I want to use the rows in the Rank table as the header row in the second table "DataTable".
I have tried using =INDEX(A2:E8,2,1) as well as structured references like
=Count(Indirect("Rank["$A$2"]"))
and
=Count(Indirect(Rank[[Attribute]],[A2])).
I either get an error that the formula has a mistake OR I get a value of 0 in the cell with the formula gone.
How do I get the text from the Rank table in cell A2 to be the header in column E of the DataTable?
Column() will return the number of the column in your new table. You can use this to relate to the row in the first table.
Something along the lines of =INDIRECT("RankSheet!A"&COLUMN()-3)
The "-3" assumes that this is going in cell E1 of the new sheet, but that you want cell A2 in the Rank table, so the formula evaluation looks like:
INDIRECT("RankSheet!A" & 5-3)
INDIRECT("RankSheet!A" & 2)
INDIRECT("RankSheet!A2")
Then, as you drag this across, the increasing COLUMN reference will refer to an increasing row reference on the RANK table.
Related
I need to compare the B2 Cell value (6012469) with Column A i.e. cell A2 to A10 and return the b2 cell value (6012469) in column C where the value matches i.e. cell C5,C7, C9 AND C10 and NA in remaining cells where the value is not matched.
I have around 15000 rows of data is column A and need to automate the process.
I have attached the sample image for reference.
[1]: https://i.stack.imgur.com/DvzC3.png
Select any cell inside your data range in Column A. Go to your ribbon, click Home > Format as Table. It doesn't matter what colour scheme you choose.
Make sure that all your data in Col A plus Cols B & C are included in the table.
Then, in any cell of your table in Col C (e.g. in C2), paste this formula:
=IF(ISNUMBER(SEARCH($B$2,[#[Column A]])),$B$2,"")
Excel should automatically populate all of your Col C in the table with this formula. (If it doesn't, then you should see a little clickable prompt next to the cell asking if you want to overwrite all the other Col C cells with this formula.)
The table with the Col C formulas would look something like this:
Note: Of course, you could achieve something very similar without using a structured table, but not as conveniently as this because you would have to copy the formulas down to the other approx. 15000 rows. Even the Fill Down feature is not as convenient.
ADDITIONAL: a different formula in response to the asker's request that each cell in Column C match any of multiple values in Column B --
=IFERROR(INDEX($B$2:$B$4,MATCH(TRUE,ISNUMBER(SEARCH($B$2:$B$4,A2)),0)),"")
NOTE: if more than one Column B value matches a Column A cell, Column C will display Column B's topmost match
I have been using VLOOKUP() to populate worksheets with Inventories, however I'm stuck with an issue where one column has the same value in multiple cells, I need to match 2 cells from sheet 2 with sheet 1 and have it return the 3rd cell from sheet 1 into sheet 2.
I'm working with about 350 rows in both sheets, and in some cells the same/different values repeat it self hence needing it to match with 2 cells in the same row.
This is the formula I currently use:
=VLOOKUP(A1&L1,'Sheet1'!$A$1:$E$351,3,FALSE)
I'm expecting it to return the value that's in the 3rd column on sheet 1 in the row that matched the values of Cell A1 and L1 in sheet 2. and the same going on A2 & L2 then A3 & L3 and so forth.
Unless you have values in Column A of your 'Sheet1' that are the equal to to concatenation of your values in Columns A and L in 'Sheet2', the formula will not work.
Instead, I'd try FILTER if you have the newest version of Excel. Something like:
=FILTER('Sheet1'!$C$1:$C$351,
(('Sheet1'!$A$1:$A$351=A1)*('Sheet1'!$L$1:$L$351=L1)))
Another option is INDEX. Something like:
=INDEX('Sheet1'!$C$1:$C$351,
MATCH(A1&L1, 'Sheet1'!$A$1:$A$351&'Sheet1'!$L$1:$L$351,0),
3)
The only way to do this task is to use a helper column
Go to Sheet one where the data table is, insert a column at the starting point of data e.g your Data set starting in SHEET1 from the column A. so insert new column in A
use this formula in A1
=CONCATENATE(B1,C1,D1,E1,F1) Press Enter, Drag the formula down to A351
now go to sheet2 and use this formula in the result cell
=VLOOKUP(A1&L1,'Sheet1'!$A$1:$F$351,4,0)
Sheet 1 goes like this:
Sheet 2 should be like this:
ITEMS QUANTITIES
APPLE 4
GUAVA 2
Sorry for writing the spreadsheet in here, as I'm not allowed to include more than 1 image yet.
Suppose you have the following named ranges:
ITEMS being the data in ITEMS column on your Sheet1;
QUANTITY being the data in QUANTITY column on your Sheet1.
Enter the following formula in Cell D2 on your Sheet2:
=IFERROR(INDEX(ITEMS,MATCH(0,COUNTIF($D$1:D1,ITEMS),0)),"")
Please note it is an array formula which requires you to press Ctrl+Shift+Enter upon finishing the formula in the formula bar.
Drag it down until there is no more items showing up.
Then you can enter the following formula in Cell E2 on your Sheet2 and drag it down:
=SUMIF(ITEMS,D2,QUANTITY)
As you can see from the above screenshot, there may be some empty cells in Column D as I used IFERROR to return blank cells if there is no more distinct item. The corresponding quantity will be 0 consequently. You can choose to delete them or hide them on your worksheet.
By the way I am not sure why Pivot Table is out of the picture as it is actually a faster and easier approach than formula and you do not have to worry about the blank cells returned by the formula if the number of unique items is uncertain. All you need to do is to highlight the source data, insert a pivot table, and put the ITEM in Rows and QUANTITY in Values field.
EDIT: Update to also extract unique distinct values:
Enter this formula in cell A2 of Sheet2:
=IFERROR(LOOKUP(2,1/(COUNTIF($A$1:A1,Sheet1!$A$2:$A$300)=0),Sheet1!$A$2:$A$300), "")
Change 300 to the actual last row of your data and copy that formula down until it returns empty cells.
Then just use a regular SUMIF in cell B2 of Sheet2:
=SUMIF(Sheet1!A2:A300, A2, Sheet1!B2:B10)
Then, type whatever fruit you're looking for incell A2 of Sheet2. Continue like this in the following rows for all the fruits you need.
I have two tables of data, call them table 1 and 2. In table 1 there is a long list of reference numbers. Each reference number has its own cell.
In table 2 I have the exact same reference numbers; however, in table 2 these reference numbers may or may not share that cell with another reference number. See below. The bottom three reference numbers in table 1 all share the same cell and are separated by a comma always.
Imagine table 1 and 2 are on separate tabs of the same workbook.
table 1 and 2
On the work sheet for table 1, I am trying to bring back the month found adjacent to the reference number in table 2. I am trying to take the value in table 1, search it in table 2, and return the month so that I get this result:
result in column b of table 1
I would like to avoid delimiting the values in the shared cells of table 2.
Thanks in advance for your help!
If your reference number are unique, you can get by with doing a wildcard vlookup
Assume you have a range in columns F and G where your reference numbers and months are. In Range A:B you want the values.
Essentially you are looking up like this.
If my value A1 is in column F and it matches a substring get the value from G
So you would use this formula in B1
=VLOOKUP(CONCATENATE("*", A1, "*"),$F$1:$G$6,2, FALSE)
what this is doing is, get the value from A1, and match the range of F:G where the first column CONTAINS A1, get the value from the corresponding G column
From there copy paste the formula for the rest of the
cells in B column
I have some data that's structured in a table like this:
.
I have another tab on my spreadsheet where I eliminate any duplicate category entries and want to concatenate the data to look like this:
I need to create this using a function and not a macro or Visual Basic. I've already written the function to eliminate any of the duplicate category entries and now I need to figure out how to take each of those unique categories and append the data behind it. Any ideas?
Assuming the first image comes from Sheet1 and the second Sheet2, here's a way to do it. You need to add at least one calculated column to Sheet1 and optionally two calculated rows to Sheet2.
Uniquely identify each row on Sheet1. Add a new column A with the formula =B3&COUNTIF($B$3:B3,B3) in A3 and fill down. You'll have first1 in A3, first2 in A4 and so on.
Identify each block of columns on Sheet2. Add a new row 6 with the formula =COUNTIF($B$2:B2,B2) in B6 and fill across. The values will be 1,1,1,2,2,2,3,3,3. You can type these in manually if you like but it won't scale as easily.
Work out the column of each data item in Sheet1 and put in the columns for Sheet2. Add a new row 7 to Sheet2 with the formula =MATCH(B2,Sheet1!$A$2:$E$2,0) and fill across. The values will be 3,4,5,3,4,5,3,4,5. We now know, for each cell in Sheet2, which instance of the category we have and in which column the data variable comes from.
Use VLOOKUP to find first1 and return data column 3 within the data table. On Sheet2, set cell B3 to =VLOOKUP($A3&B$6,Sheet1!$A$2:$E$8,B$7,FALSE) and fill down and across.
You'll have a number of #N/A errors (e.g. cell E4). If you have a newer version of Excel, you can use IFERROR() to escape this; otherwise, use =IF(ISNULL(<formula>), "", <formula>) where <formula> is the formula in step 4.
To summarise:
Create a unique, sequential, calculable row ID for each row in the source.
Determine which instance of that sequence is used by each column in the destination. This is appended to the end of the category to determine the row IDs formed in the previous step.
Determine which column contains the data for each column in the destination.
Look up the row with the calculated row ID and find the relevant column for this data item.
Format the results appropriately.