Picking Values from a Table

Steve 1962

Active Member
Joined
Jan 3, 2006
Messages
282
Office Version
  1. 365
Hi All

I am inputting values into row 2 under certain labels. Each label has a value which corresponds with the values in table A5:B9. The total is then shown in cell B12 (product of a multiplication).

I am trying to remove the intermediate step which requires table D12:E16. I assume a MATCH / INDEX / HLOOKUP or SUMPRODUCT formula may be the answer but I'm not sure.

There are only 5 labels shown here but I need the flexibility to expand.

Thanks




<b></b><table cellpadding="2.5px" rules="all" style=";background-color: rgb(255,255,255);border: 1px solid;border-collapse: collapse; border-color: rgb(187,187,187)"><colgroup><col width="25px" style="background-color: rgb(218,231,245)" /><col /><col /><col /><col /><col /></colgroup><thead><tr style=" background-color: rgb(218,231,245);text-align: center;color: rgb(22,17,32)"><th></th><th>A</th><th>B</th><th>C</th><th>D</th><th>E</th></tr></thead><tbody><tr ><td style="color: rgb(22,17,32);text-align: center;">1</td><td style="text-align: center;;">ABC</td><td style="text-align: center;;">DEF</td><td style="text-align: center;;">GHI</td><td style="text-align: center;;">JKL</td><td style="text-align: center;;">MNO</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">2</td><td style="text-align: center;;">2</td><td style="text-align: center;;">0</td><td style="text-align: center;;">5</td><td style="text-align: center;;">0</td><td style="text-align: center;;">6</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">3</td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td></tr><tr ><td style="color: rgb(22,17,32);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></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">5</td><td style=";">ABC</td><td style="text-align: right;;">16.1</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">6</td><td style=";">DEF</td><td style="text-align: right;;">12.8</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">7</td><td style=";">GHI</td><td style="text-align: right;;">15.4</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">8</td><td style=";">JKL</td><td style="text-align: right;;">11.4</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">9</td><td style=";">MNO</td><td style="text-align: right;;">12.5</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">10</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: rgb(22,17,32);text-align: center;">11</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: rgb(22,17,32);text-align: center;">12</td><td style=";">Total</td><td style="text-align: right;;">184.2</td><td style="text-align: right;;"></td><td style=";">ABC</td><td style="text-align: right;;">32.2</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">13</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style=";">DEF</td><td style="text-align: right;;">0.0</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">14</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style=";">GHI</td><td style="text-align: right;;">77.0</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">15</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style=";">JKL</td><td style="text-align: right;;">0.0</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">16</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style=";">MNO</td><td style="text-align: right;;">75.0</td></tr></tbody></table><p style="width:4.8em;font-weight:bold;margin:0;padding:0.2em 0.6em 0.2em 0.5em;border: 1px solid rgb(187,187,187);border-top:none;text-align: center;background-color: rgb(218,231,245);color: rgb(22,17,32)">Sheet2</p><br /><br /><table width="85%" cellpadding="2.5px" rules="all" style=";border: 2px solid black;border-collapse:collapse;padding: 0.4em;background-color: rgb(255,255,255)" ><tr><td style="padding:6px" ><b>Worksheet Formulas</b><table cellpadding="2.5px" width="100%" rules="all" style="border: 1px solid;text-align:center;background-color: rgb(255,255,255);border-collapse: collapse; border-color: rgb(187,187,187)"><thead><tr style=" background-color: rgb(218,231,245);color: rgb(22,17,32)"><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: rgb(218,231,245);color: rgb(22,17,32)">B12</th><td style="text-align:left">=SUM(<font color="Blue">E12:E16</font>)</td></tr><tr><th width="10px" style=" background-color: rgb(218,231,245);color: rgb(22,17,32)">E12</th><td style="text-align:left">=A2*B5</td></tr><tr><th width="10px" style=" background-color: rgb(218,231,245);color: rgb(22,17,32)">E13</th><td style="text-align:left">=B2*B6</td></tr><tr><th width="10px" style=" background-color: rgb(218,231,245);color: rgb(22,17,32)">E14</th><td style="text-align:left">=C2*B7</td></tr><tr><th width="10px" style=" background-color: rgb(218,231,245);color: rgb(22,17,32)">E15</th><td style="text-align:left">=D2*B8</td></tr><tr><th width="10px" style=" background-color: rgb(218,231,245);color: rgb(22,17,32)">E16</th><td style="text-align:left">=E2*B9</td></tr></tbody></table></td></tr></table><br />
 

Some videos you may like

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
48,466
Office Version
  1. 365
Platform
  1. Windows
How about
=SUMPRODUCT((A1:E1=A5:A9)*(A2:E2)*(B5:B9))
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
48,466
Office Version
  1. 365
Platform
  1. Windows
You're welcome & thanks for the feedback
 

Steve 1962

Active Member
Joined
Jan 3, 2006
Messages
282
Office Version
  1. 365

ADVERTISEMENT

Hi Fluff

I've found one small issue. If the values in B5:B9 are arrived at using a formula, I get the #Value ! error.

Is there a way around this so that I can use the values that are from a formula ?

Thanks
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
48,466
Office Version
  1. 365
Platform
  1. Windows
The fact that you have formulae in B5:B9 shouldn't make any difference, unless one or more of them is returning #VALUE ! or "", in which case you need to change that formula so that it returns 0
 

Steve 1962

Active Member
Joined
Jan 3, 2006
Messages
282
Office Version
  1. 365
Correct again Fluff. I did have an IF statement that returned a "" if true. I have now changed this to return 0.

All works fine again thanks.
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
48,466
Office Version
  1. 365
Platform
  1. Windows
Glad to help & thanks for the feedback
 

Watch MrExcel Video

Forum statistics

Threads
1,114,560
Messages
5,548,737
Members
410,869
Latest member
eSoftToolsNSFtoPSTConvert
Top