Addition formula in a single cell

thespardian

Board Regular
Joined
Aug 31, 2012
Messages
119
Office Version
  1. 2016
  2. 2013
Platform
  1. Windows
Hi there
I have a four product code (i.e r,p,E,Y)in cell range A1:A4 and the price for that product is mentioned against each code in cell range B1:B4 (i.e 6.87, 9.18, 10.54, 22.73).
I am seeking for a formula for following purpose
if i enter multiple codes in a single cell (say Er,Yp,EY, EE, Yr, YYp,YEp etc it could be any combination of above four letter) the price should be appear in cell D1
Any help would be higly appriciated
 
Last edited:

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
Re: Help regarding addition formula in a single cell please

i.e

<table border="1" cellspacing="0" style="font-family:Calibri,Arial; font-size:11pt; background-color:#ffffff; "> <colgroup><col style="font-weight:bold; width:30px; " /><col style="width:76.04px;" /><col style="width:76.04px;" /><col style="width:76.04px;" /><col style="width:76.04px;" /><col style="width:140.67px;" /></colgroup><tr style="background-color:#cacaca; text-align:center; font-weight:bold; font-size:8pt; "><td > </td><td >A</td><td >B</td><td >C</td><td >D</td><td >E</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >1</td><td >r</td><td style="text-align:right; ">6.87</td><td > </td><td >Yep</td><td >22.73, 10.54, 9.18</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >2</td><td >p</td><td style="text-align:right; ">9.18</td><td > </td><td > </td><td > </td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >3</td><td >E</td><td style="text-align:right; ">10.54</td><td > </td><td > </td><td > </td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >4</td><td >Y</td><td style="text-align:right; ">22.73</td><td > </td><td > </td><td > </td></tr></table>

If you put "Yep" in cell D1, what do you expect in cell E1?
The product code is always a single letter?
Are there only 4 codes or do you have more?
 
Upvote 0
Re: Help regarding addition formula in a single cell please

Thanks for your help, if i put "Yep" i expect 22.73+10.54+9.18

Its not certain. But it will remain between 1 to 6 characters(e.g E or EY, or EYr or EYpr, EErYYp)

Yes, i have only four codes and they are single character in a cell
 
Last edited:
Upvote 0
Re: Help regarding addition formula in a single cell please

Hi,

Below should work for you:


Book1
ABCDE
1r6.87YEEP52.99
2p9.18
3E10.54
4Y22.73
Sheet9
Cell Formulas
RangeFormula
E1{=SUM(TRANSPOSE(INDIRECT(ADDRESS(MATCH(MID(D1,ROW(INDIRECT("1:"&LEN(D1))),1),$A$1:$A$4,0),2))))}
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0
Re: Help regarding addition formula in a single cell please

It works like a charm. Thanks a lot for guidance. Stay blessed.
 
Upvote 0
Re: Help regarding addition formula in a single cell please

Glad could help! :)
 
Upvote 0
Re: Help regarding addition formula in a single cell please

Another non-array option:

ABCDE
1r6.87YEEP52.99
2p9.18
3E10.54
4Y22.73

<colgroup><col style="width: 25pxpx"><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet2

Worksheet Formulas
CellFormula
E1=SUMPRODUCT(B1:B4*(LEN(D1)-LEN(SUBSTITUTE(UPPER(D1),UPPER(A1:A4),""))))

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>
 
Upvote 0
Re: Help regarding addition formula in a single cell please

Thanks a ton for your input, Eric, i'll definatly try it. Stay blessed
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,422
Messages
6,119,395
Members
448,891
Latest member
tpierce

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