1
votes

I have an excel formula, which is supposed to work but returns #VALUE and I cannot figure out why.

I have this table:

       A        B
1 |          |     |
2 | Oranges  |  1  |
3 | Apples   |  2  |
4 | Grapes   |  3  |
5 | Oranges  |  4  |
6 | Apples   |  5  |
7 | Grapes   |  6  |
8 | Apples   |  7  |

I want to Check for matching values in Column A like "Apples", "Oranges", etc. and return all the corresponding values from Column B in one row:

The output should be like this but I only get #VALUE:

       A         B     C     D  
11 | Apples   |  2  |  5  |  7  |
12 | Oranges  |  1  |  4  | #NUM|

This is the formula:

=INDEX($B$2:$B$8, SMALL(IF($A$11=$A$2:$A$8, ROW($A$2:$A$8)-ROW($A$2)+1), COLUMN(A1)))

2
This is an array formula. To enter a formula as an array formula, type the formula in the cell and press the CTRL SHIFT and ENTER keys at the same time rather then just ENTER.Axel Richter
This was the solution! Thank you very much! You can have it as an answer and I will accept.BradG

2 Answers

4
votes

I hope this formula help you.. you need to press Ctrl + shift + enter to get the formula working, you need to order the PRODUCT column by name to get the formula working properly.

=IF(COLUMN()-4<=COUNTIF($A$2:$A$8,$D2),INDEX($B$2:$B$8,MATCH($D2,$A$2:$A$8,0)+COLUMN()-5),"")

the -4 is referencing the column where you are going to lookup the value and the -5 is where you are going to get the value.

The column "c" is empty

COL    A         B          C         D           E       F        G      H
    PRODUCT  DESCRIPTION         uniquevalues  descr1   descr2  descr3  descr4
    oranges      1                 oranges        1       2     
    oranges      2                 apples         3       4        5    
    grapes       6                 grapes         6       7     
    grapes       7                      
    apples       3                      
    apples       4                      
    apples       5                      

I hope it is not too late :P.. you're welcome.

0
votes

To avoid #NUM error use this modified formula

=IFERROR(INDEX($B$2:$B$8,SMALL(IF($A$11=$A$2:$A$8,ROW($A$2:$A$8)-ROW($A$2)+1),COLUMN(A1))),"")