Capture adjacent Cell with condition Ask Question - excel-formula

Capture adjacent Cell with condition
I have values in A column and corresponding values in B column. I need to capture based on A column value I need to capture adjacent cell value which has no zeros.

Say we have data like:
and we want to retrieve a value from column B that corresponds to alpha in column A, but which is not 0. We can use an array formula with MATCH()to achieve this:
First place:
alpha
in cell D1 and in E1 enter the array formula:
=INDEX(B:B,MATCH(1,(A:A=$D$1)*(B:B<>0),0),1)
Array formulas must be entered with Ctrl + Shift + Enter rather than just the Enter key. If this is done correctly, the formula will appear with curly braces around it in the Formula Bar.

Related

Find a match on two excel columns

I want to compare data between two tables on excel and get the cells that match in two columns.
i.e:
Look for the value from cell G9 in column A, if found the check if the value of cell J9 Equals to cell D of the row in which the first match was found.
I tried Vlookup, index and match, but I'm still missing a function to complete the syntax
=IF(VLOOKUP(G9,$A$9:$D$1127,1,FALSE),IF(J9=D,"","new"),"new")
I don't know what to insert instead of D
Sample: https://drive.google.com/open?id=1aJZlpQ2V-bmwmS1Kwk-OIiSvXR552JJH
You can use MATCH on an array premises. If you want the number of the line when the values of G9 and J9 occur on columns A:A and D:D simultaneously, use the formula:
{=IFERROR(MATCH(J9,IF(A:A=G9,D:D),0),"No Match")}
If you want to return just the word "new" in case of a valid match use:
{=IFERROR(IF(MATCH(J9,IF(A:A=G9,D:D),0)>0,"new",""),"")}
Don't forget to use Ctrl + Shift + Enter to place the braces on the formula.
EDIT:
Since I'm having some troubles with showing my solution, I'll be more thorough.
Let's imagine you have the following worksheet:
For each row in the first table, if you want to check a match on the second table, you could place the formula
{=IFERROR(IF(MATCH(A1,IF(E:E=B1,D:D),0)>0,"new",""),"")}
on cell C1 and drag it to the end (to C22 on my example). You will get the next result:
Please, don't forget to press Ctrl + Shift + Enter when you're entering the formula on cell C1.

Capture adjacent Cell with condition

I have values in A column and corresponding values in B column. I need capture based on A column value I need to capture adjacent cell value which has no zeros.
In my below example:
The formula in D1 translates to:
{=INDEX(B1:B6,SMALL((A1:A6=C1)*(B1:B6>0)*(ROW(B1:B6)),COUNTIF(B1:B6,0)+1))}
Notice it's an array formula that you must enter through CtrlShiftEnter
It will return the first match that isn't zero.

excel: list all values of a column of a range based on a condition

I have a range in a Excel Sheet table that contains 2 columns like A and B.
I want to list in another column all values from column A if the corresponding value in column B is not null.
I know a way to do it, but it produces a lot of "empty raws" like in column C
=if(B<>"";A;"")
I would like to do it in a compact way, with no "empty raws" like in column D
Here is an example for data down to row #19. In C1 enter the array formula:
=IFERROR(INDEX($A$1:$A$19,SMALL(IF($B$1:$B$19<>"",ROW($B$1:$B$19)),ROW(1:1))),"")
and copy downwards. (You may need to use semi-colons in place of commas)
Array formulas must be entered with Ctrl + Shift + Enter rather than just the Enter key. If this is done correctly, the formula will appear with curly braces around it in the Formula Bar.

Summing result of formula applied to rows

I have a column of numbers and would like to summarize the result of a formula applied to each row.
For example, if my formula is to square the cell value, in the following table I would like B1 to represent A1^2 + A2^2 + A3^2.
A B
- -
1 14
2
3
Is this possible without creating a column to store the result of the formula for each row before summing (i.e. here, a column containing 1, 4, 9)?
For your example:
=SUM((A1:A3)^2)
But here is the key: enter it as an array formula with Ctrl+Shift+Enter. It will add braces to it and should work.
It should look like this after pressing Ctrl+Shift+Enter:
{=SUM((A1:A3)^2)}
For summing squares of range values, please use this formula =SUMSQ(A2:A80).
So if you have data in Column A, put above formula in cell B2.

Return multiple values from a range

To return a value corresponding to another cell from a range if it matches with a cell, I found Chuff's solution helpful (in
Excel - match data from one range to another and get the value from the cell to the right of the matched data ):
=iferror(vlookup(b31,$f$3:$g$12,2,0),"")
However, if there are more than one cells within the column F which match with b1, the formula returns the value of only one cell from the column G.
Could it be modified so as to attract the value of more than one cell?
Thank you!
To return multiple corresponding Vlookup values you should use this formula: =IFERROR(INDEX($B$2:$B$9,SMALL(IF($E1=$A$2:$A$9,ROW($A$2:$A$9)-ROW($A$2)+1),COLUMN(A1))),"")
Because it it an array formula, please enter it using combination of CTRL+SHIFT+ENTER . For example, if you have you lookup range in A:B column, and lookup values in D column, then please enter formula above to F1 cell, then drag it to the right and to the bottom. You should now see all instances of Vlookup next to the lookup value in D column.
If you have only values which you want to sum in case they correspond to your value in cell B31, then simply use SUMIF formula like this =SUMIF($F$3:$F$10,$B31,$G$3:$G$10) entered in cell C31.

Resources