# Use Index Match to fill in columns Sheet 1 based on data in Sheet 2

#### roba730

##### New Member
I have Sheet 1 with an account number in column a and column B-Y are different products that each account may own. I would like to have the sheet filled out as seen below. I think I will be able to fill in the X's using Index Match.

Account#BCDEFGHIJKLMNOPQRSTUVWXYZ
 14331937

<tbody>
</tbody>
xxxx
 14346609

<tbody>
</tbody>
xxxxxx

<tbody>
</tbody>

I have a second sheet in which each row contains an account number in Column A and a product they own in Column B. Each account number may own multiple products which will be found on multiple rows.

AB
Account#Product
14331937C
14331937R
14331937F
14331937Z
 14346609

<tbody>
</tbody>
B
 14346609

<tbody>
</tbody>
J
 14346609

<tbody>
</tbody>
N
 14346609

<tbody>
</tbody>
R
 14346609

<tbody>
</tbody>
T
14346609W

<tbody>
</tbody>
I have never used Index Match.

### Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.

#### CodeNinja

##### Well-known Member
You could use the following formula in sheet 1 cell B2... copy over to Z2 and down...

=IF(SUMPRODUCT((Sheet2!\$A\$3:\$A\$12=Sheet1!\$A2)*(Sheet2!\$B\$3:\$B\$12=Sheet1!B\$1)),"x","")

Good luck,
CN.

#### roba730

##### New Member
You could use the following formula in sheet 1 cell B2... copy over to Z2 and down...

=IF(SUMPRODUCT((Sheet2!\$A\$3:\$A\$12=Sheet1!\$A2)*(Sheet2!\$B\$3:\$B\$12=Sheet1!B\$1)),"x","")

Good luck,
CN.

Thank you CN this works.

To help me understand how it does work I have a question; does the * in the formula mean AND or MULTIPLY?

Thx again, Rob

#### CodeNinja

##### Well-known Member
To help me understand how it does work I have a question; does the * in the formula mean AND or MULTIPLY?

Well, that depends on how you look at it...

The sumproduct formula is special because it handles arrays.
The first part (Sheet2!\$A\$3:\$A\$12=Sheet1!\$A2) results in Nine Trues or Falses.
The second part (Sheet2!\$B\$3:\$B\$12=Sheet1!B\$1)) also results in 9 Trues or Falses.

The * literally means multiply... so we multiply an array of 9 trues or falses against another array of 9 trues or falses... this action turns into an array of 1's or 0's....
IE {True, True, False, False}*{True, False, True, False} would = {1, 0, 0, 0}
So in essence, you can think of it as an AND ... so TRUE AND TRUE would be 1, but TRUE AND FALSE, FALSE AND FALSE, or FALSE AND TRUE would all = 0...

The answer is, you can think of it both ways ... It does mean "AND"... it also does mean Multiply

Hope that hasn't made this more confusing...

CN.

#### Mike Szczesny

##### Active Member
Hi,
Can you use something like this?
Mike Szczesny

<b>Excel 2012</b><table cellpadding="2.5px" rules="all" style=";background-color: #FFFFFF;border: 1px solid;border-collapse: collapse; border-color: #BBB"><colgroup><col width="25px" style="background-color: #DAE7F5" /><col /><col /><col /><col /><col /><col /><col /><col /></colgroup><thead><tr style=" background-color: #DAE7F5;text-align: center;color: #161120"><th></th><th>A</th><th>B</th><th>C</th><th>D</th><th>E</th><th>F</th><th>G</th><th>H</th></tr></thead><tbody><tr ><td style="color: #161120;text-align: center;">1</td><td style="text-align: right;;"></td><td style=";">a</td><td style=";">b</td><td style=";">c</td><td style=";">d</td><td style=";">e</td><td style=";">f</td><td style=";">g</td></tr><tr ><td style="color: #161120;text-align: center;">2</td><td style=";">i</td><td style="text-align: right;;"></td><td style=";">x</td><td style="text-align: right;;"></td><td style=";">x</td><td style=";">x</td><td style=";">x</td><td style="text-align: right;;"></td></tr><tr ><td style="color: #161120;text-align: center;">3</td><td style=";">ii</td><td style=";">x</td><td style="text-align: right;;"></td><td style=";">x</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style=";">x</td></tr><tr ><td style="color: #161120;text-align: center;">4</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr><tr ><td style="color: #161120;text-align: center;">5</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr><tr ><td style="color: #161120;text-align: center;">6</td><td style=";">i</td><td style=";">b</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr><tr ><td style="color: #161120;text-align: center;">7</td><td style="text-align: right;;"></td><td style=";">d</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr><tr ><td style="color: #161120;text-align: center;">8</td><td style="text-align: right;;"></td><td style=";">e</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr><tr ><td style="color: #161120;text-align: center;">9</td><td style="text-align: right;;"></td><td style=";">f</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr></tbody></table><p style="width:3.6em;font-weight:bold;margin:0;padding:0.2em 0.6em 0.2em 0.5em;border: 1px solid #BBB;border-top:none;text-align: center;background-color: #DAE7F5;color: #161120">Sheet1</p><br /><br /><table width="85%" cellpadding="2.5px" rules="all" style=";border: 2px solid black;border-collapse:collapse;padding: 0.4em;background-color: #FFFFFF" ><tr><td style="padding:6px" ><b>Array Formulas</b><table cellpadding="2.5px" width="100%" rules="all" style="border: 1px solid;text-align:center;background-color: #FFFFFF;border-collapse: collapse; border-color: #BBB"><thead><tr style=" background-color: #DAE7F5;color: #161120"><th width="10px">Cell</th><th style="text-align:left;padding-left:5px;">Formula</th></tr></thead><tbody><tr><th width="10px" style=" background-color: #DAE7F5;color: #161120">B6</th><td style="text-align:left">{=INDEX(<font color="Blue">\$B\$1:\$H\$1,SMALL(<font color="Red">IF(<font color="Green">\$A\$2:\$A\$3=\$A\$6,IF(<font color="Purple">\$B\$2:\$H\$3="x",COLUMN(<font color="Teal">\$B\$1:\$H\$1</font>)-COLUMN(<font color="Teal">\$B\$1</font>)+1</font>)</font>),ROWS(<font color="Green">\$B\$6:B6</font>)</font>)</font>)}</td></tr></tbody></table><b>Entered with Ctrl+Shift+Enter.</b> If entered correctly, Excel will surround with curly braces {}.
<b>Note: Do not try and enter the {} manually yourself</b></td></tr></table><br />

Replies
0
Views
125
Replies
7
Views
101
Replies
5
Views
118
Replies
5
Views
210
Replies
3
Views
145

Understanding data is crucial, and the easiest place to start is with Microsoft Excel.

1,151,605
Messages
5,765,385
Members
425,281
Latest member
tmoreira001

### 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.

### Which adblocker are you using?

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

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