Match with multiple columns

topi1

Active Member
Joined
Aug 6, 2014
Messages
252
Office Version
  1. 2010
In the following example, I have a list of fruits and vegetables in Column A. Columns D and E have names of few fruits and vegetables. In the column B, I have entered countif formula to see if the object in the column A is a fruit or vegetable. The formula works but in real life I have numerous columns and not just D & E, and I don't know how to write something which will look at each of those columns and then get the answer which will be equal to the first row of the matched column. B will be blank if unmatched. Thank you in advance.

Book2
ABCDE
1VegetableFruit
2CarrotsGrapes
3BroccoliVegetableBroccoliBanana
4OrangeFruitSpinachOrange
5SpinachVegetablecucumbersApple
6AppleFruit
7
8
9
10
11
12
13
14
15
Sheet1
Cell Formulas
RangeFormula
B3:B6B3=IF((COUNTIF($D$2:$D$15,$A3)=1),$D$1,IF((COUNTIF($E$2:$E$15,$A3)=1),$E$1,""))
 
you must put the formula in cell B3, edit it, press the 3 keys Shift + Control + Enter and then copy the formula down.
It seems you are selecting all cells B3 to B7 and then pressing the 3 keys and that is not how it should be.
👆
 
Upvote 0

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
No, that's not the problem.

The problem is that you must put the formula in cell B3, edit it, press the 3 keys Shift + Control + Enter and then copy the formula down.
It seems you are selecting all cells B3 to B7 and then pressing the 3 keys and that is not how it should be.

Yes, Sir! That worked. Thanks for sticking with me. Appreciate it.
 
Upvote 0
If you did want an option without the need for Ctrl+Shift+Enter (which would be required again if you edit the formula, say to change the ranges) you could try this one.

24 01 15.xlsm
ABCDEF
1VegetableFruitLiquid
2CarrotsGrapesVino
3BroccoliVegetableBroccoliBanana
4OrangeFruitSpinachOrange
5SpinachVegetablecucumbersApple
6AppleFruitSpinach
7VinoLiquid
topi1
Cell Formulas
RangeFormula
B3:B7B3=INDEX($1:$1,AGGREGATE(15,6,COLUMN(D:F)/(D$2:F$6=A3),1))
 
Upvote 0
If you did want an option without the need for Ctrl+Shift+Enter (which would be required again if you edit the formula, say to change the ranges) you could try this one.

24 01 15.xlsm
ABCDEF
1VegetableFruitLiquid
2CarrotsGrapesVino
3BroccoliVegetableBroccoliBanana
4OrangeFruitSpinachOrange
5SpinachVegetablecucumbersApple
6AppleFruitSpinach
7VinoLiquid
topi1
Cell Formulas
RangeFormula
B3:B7B3=INDEX($1:$1,AGGREGATE(15,6,COLUMN(D:F)/(D$2:F$6=A3),1))
That works very well! I appreciate it greatly.
 
Upvote 0

Forum statistics

Threads
1,223,886
Messages
6,175,190
Members
452,616
Latest member
intern444

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top