I want to match specific rows and columns.
If A2 is matched with B1, then return list "ROW 1" in B2:B151
If A5 is matched with B5 then return list "ROW 4" in B2:B151
As explained in the image B2 is feed by a Dropdown from another sheet (This is not part of the question)
I am trying to override this list in B2:B151 every time a new match is made.
I haven't got a clue on how to proceed have tried multiple Index and match combination even Vlookup which is not viable for this sort of problem.
I was thinking of concatenating all these formulas in B2. The reason why I want to use Rows and columns to determine the specific match is that the data in B1 an A2:A7 is ever-changing and that's the reason why the formula needs to be dynamic.
I think this is what you want, but I'm not 100% sure of the desired final outcome.
The formula in B1 is
=OFFSET($D2,0,MATCH($B$1,PhaseArrayList,0)-1,1,1)
and you can just copy that down as many rows as you need. When you change the value in B1 it will update.
The Offset says says start at D2, go 0 rows down, go to the right the number of columns equal to the match of B1 less 1. So if C is in B1 the match returns 3 and the offset goes across 2 columns, i.e. to column F (ROW 3).
(Btw would be less confusing if you labelled them columns!)
Related
I asked a question a few hours ago and now I'm trying a different approach on the same issue.
I want to get the largets numbers from a table and the corresponding description.
The selected cell has the formula =LARGEST(S:S,1), =LARGEST(S:S,2) and so on...
The issue is that 4 and 5 is the exact same value which makes my INDEX MATCH formula (=INDEX(P:P,MATCH(U5,S:S,0)) U5 is selected cell) in the cell adjacent to the selected cell find the same product twice.
But if we look in the table to the right which is a copy paste values so that it can be sorted, 4 and 5th largest values are not the same product.
Can I somehow change the index match formula to the n-th of the same value so that it's "correct"?
This is a common problem. You must remove ties so your INDEX(MATCH()) can find all the matches. Consider:
Note the both Patricia and Mary have the same scores. In C2 enter:
=RANK(A2,$A$2:$A$11,0)+COUNTIF($A$2:$A2,A2)-1
and copy downwards. Column C tracks column A, but has no ties! (a simple sequential list with no duplicates or gaps)
Finally in E2 and F2 enter:
=INDEX($A$2:$A$11,MATCH(ROWS($1:1),$C$2:$C$11,0))
=INDEX($B$2:$B$11,MATCH(ROWS($1:1),$C$2:$C$11,0))
and copy these downwards.
From my research, when a bunch of cells are merged, you can only reference the first row and first column of the merged cells. EG. if A1:A3 are merged, then I can only access the data using A1 only, and A2 and A3 returns 0.
Now let's say I have a column B that has a formula that calculates based on values in column A. If I drag this formula down, then B2 and B3 will end up using value of 0, when they should be using value in A1.
Effectively, what i want to do is "if the cell in column A (of this row) is blank, then use the last non-blank value going upwards".
I know this will need to combine a couple of formulas, but I can't figure out how to create this. For a start, I can use the Offset function to "go up", but the difficult part here is how to find the previous non-blank cell?
I also tried combing OFFSET with COUNTA (see https://www.exceltip.com/other-qa-formulas/get-the-value-of-the-last-non-blank-cell-in-a-column-in-microsoft-excel.html), but this doesn't work if this occurs multiple times.
Easiest way is to use a helper column:
In B2 write
=IF(NOT(ISBLANK(A2)),0,B1+1)
and in C2 write
=OFFSET(A2,-B2,0)
Edit: actually... the solution without helper column is even easier! Write in B2:
=IF(ISBLANK(A2),B1,A2)
To avoid the helper column, you can use the INDEX + AGGREGATE functions:
=INDEX($A$1:A1,AGGREGATE(14,6,($A$1:A1<>"")*ROW($A$1:A1),1))
I am trying to create a formula which compares numerical values of two columns and when a match is found return data from a different column.
Here is the problem I am having - the formula I have come up with seems to go Row by Row - for example, if column A & B are the two columns I want to compare, with column C having the data I want if a match is made. If I have a value of 1 in row A1 and a value of 1 in B1 - it will successfuly return the data in column C.
The problem is that my numbers are jumping, the row's do not match, for example column A is 1,2,3 however column B is 1,3,2. The end result here is that I get data for the value 1, but on the mismatch for the second row I get no value.
Basically the formula I made seems to do a hard comparison based just off the two rows of each column - meaning it will only compare A1 to B1. What I really need is it to compare the ENTIRE column and disregard the rows completely
Here is the formula I have been fooling around with - this formula works if A1 and B1 match
=INDEX(M:M,MATCH($L:L,$V:V,0))
In this formula M has the data I need, while columns L and V have numerical values, I need it to not 'hard check' row by row and instead evaluate the entire column and when a match is found return the result (so if both columns have a '2' return that value REGARDLESS of the fact that the '2' may be in rows A2 and B9)
Hopefully I explained my issue well, and I appreciate all the help I can get
EDIT
Sorry for failing to explain it properly on my end -- I will base my explanation off the picture link below.
I need data from column B to show up in column D. What is happening is row 2 matches so the data is successfully retrieved for number 1 - however on row 3 where column A switches the numbering it compared the number '3' to the number '2' and recognizes it is not a match and returns NA -- even though there IS a match in columns A4 and C2 -- in this situation for C3 I would need the data from B4 to showup in D3
http://i.stack.imgur.com/nrKJp.png
Two formulas that will each give you the return you want, Put one of the following in D2 and copy down:
=VLOOKUP(C2,A:B,2,FALSE)
OR
=INDEX(B:B,MATCH(C2,A:A,0))
I have tried to use VLOOKUP, HLOOKUP, LOOKUP, INDEX and MATCH but haven't so far been able to solve the problem. I want to fill column A with the value adjacent to the value left of STRING that might be found in each row. The column of interest frequently differs.
E.g.
Return value of F1 if G1=STRING, F2 if G2=STRING, E3 if F3=STRING, D4 if E4=STRING
Picture
I managed to solve it by:
=IFERROR(INDEX($S2:$BJ2, MATCH("STRING", $S2:$BJ2,0)-1),"")
Now, if I want to extract the 2nd, 3rd and 4th value (if it happens to be more than one match) adjecent to "STRING" which changes have to be made?
I'm going to assume your data is in E1 to H100 - adjust as you need.
First we need the row -
SUMPRODUCT((E1:H100=A1)*ROW(E1:H100))
Then we use the same trick to get the column
SUMPRODUCT((E1:H100=A1)*COLUMN(E1:H100))
This gives us the row and column of the text
Now we use this to find the text in the next column
As the row and column are offset from cell 0,0 and A1 is 1,1 we need to subtract 1 from the row, and then 2 from the column to make it 1 cell to the left
This leaves us with the following formula:
=OFFSET(A1,SUMPRODUCT((E1:H100=A1)*ROW(E1:H100))-1,SUMPRODUCT((E1:H100=A1)*COLUMN(E1:H100))-2)
don't forget to anchor points if you go dragging the formula to fill multiple cells
The issue I'm faced with is I have two sheets of data in Excel. They are a stocksheet list, listing items that have a variance from a stocktake. The items are randomly placed between both documents, so it is almost impossible to do a side-by-side view even if I were to order the columns (which I already have). For example it would be like this:
Sheet 1:
A1 (Apple) (1)
A2 (Carrot) (-3)
A3 (Banana) (4)
A4 (Chocolate (-7)
Whereas Sheet 2 may be:
A1 (Orange) (-2)
A2 (Apple) (3)
A3 (Muffin) (-8)
A4 (Carrot) (3)
So as you can see, the same data may appear, and if it does I want to compare those two sets, to know the variance, i.e. Sheet 1 said -3 whereas sheet 2 said +1... I preferably would like to do this in a batch if possible, as there are over 800 cells to go through.
Just so that you can see what I'm dealing with, here's links to pastebins of both sheets;
Sheet 1: http://pastebin.com/6i7QKJ6N
Sheet 2: http://pastebin.com/zjtC2U7q
Is there anything anyone can think of that would be able to assist me, other than me going through this one by one which I am considering doing?
Excuse me from avoiding the real situation and sticking with your example. Assuming the values are in ColumnB in the corresponding rows, then:
in Sheet1: =VLOOKUP(A1,Sheet2!A:B,2,FALSE)
in Sheet2: =VLOOKUP(A1,Sheet1!A:B,2,FALSE)
say in ColumnsC should 'align' the entries (where both exist, otherwise #N/A). =B1=C1 in D1 copied down should then help to identify the mismatches and say =B1-C1 in E1 copied down the quantification the discrepancies between the sheets, by 'vegetable'.
There should be no need for a batch mode for this.
I'm assuming that the unique identifier for the stock items is the column labelled CYSKU, right?
If that's so, then there are only 192 common items between the two sheets. I ran a vlookup in both sheets a bit similar to the one pnuts used and used a filter.
There are more variances between CYCOST than with CYRETL as far as I can see (I haven't compared the other columns).
To perform the comparison, you can do the following:
Insert a column between columns C and F (just after CYSKU) and put a vlookup formula in row 2 of this column and fill it down:
=VLOOKUP(C2, Sheet2!C:C, 1, 0)
Insert a filter and filter out #N/A from this column to get only those that are common between the two sheets.
In column M (after CYDVAR), insert another vlookup and fill it down:
=VLOOKUP(C2, Sheet2!C:F, 4, 0)
This will give you the corresponding CYRETL from Sheet2. You can then compare the two CYRETL.
How VLOOKUP works:
The first parameter is what VLOOKUP will be looking for.
The second parameter is the table range in which to look the first parameter.
The third parameter is the nth column from which a match will be returned, limited to the table (if the table is in column A:A, only 1 column is available, if the table is A:B, 2 columns are available, etc).
The last parameter is for either exact or approximate match. Exact is 0 (or FALSE) and approximate is 1 (or TRUE).
You can just change the table range and the column number to change the value you're looking for from Sheet2.