Calculate value in brackets

Pastafarian

New Member
Joined
Feb 21, 2012
Messages
30
Hi all,

I have multiple rows with products amounts in each cell. I want the notation to be as follow: x(+y) , where x is the paid number of products and y the amount of free products. I need just the first number to calculate the total price but for calculating the total amount of products needed I need to have both.

I tried to separate both values, but with no succes.

Anybody has some code / knows how to accomplish this ? (or a better way to get the same result (With distinction between paid and free products))


Thanks!
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Order1:-------4-------5(+1)-------6-------8(+2)-------Total paid: 23
Order2:-------3-------6-----------5(+1)---4(+3)-------Total paid: 18
Order3:-------1(+1)---2(+2)-------3-------4-----------Total paid: 10

Totaal: 9 16 15 21


Hope this helps.
 
Upvote 0
I believe this will do what you need. Change references to suit.


Excel 2010
ABCDEFGH
1Product 1Product 2Product 3Product 4FreePaidTotal Items
2Order 145(+1)68(+2)32326
3Order 2365(+1)4(+3)41822
4Order 31(+1)2(+2)3431013
5Free1315
6Paid8131416
7Total Items9161521
Sheet1
Cell Formulas
RangeFormula
H2=G2+F2
B7=B5+B6
B5{=SUM(IFERROR(VALUE(MID(B2:B4,FIND("(",B2:B4)+1,FIND(")",B2:B4)-FIND("(",B2:B4)-1)),0))}
B6{=SUM(IFERROR(VALUE(LEFT(B$2:B$4,FIND("(",B$2:B$4)-1)), B$2:B$4))}
F2{=SUM(IFERROR(VALUE(MID(B2:E2,FIND("(",B2:E2)+1,FIND(")",B2:E2)-FIND("(",B2:E2)-1)),0))}
G2{=SUM(IFERROR(VALUE(LEFT(B2:E2,FIND("(",B2:E2)-1)), B2:E2))}
Press CTRL+SHIFT+ENTER to enter array formulas.


Regards
Adam
 
Upvote 0
So this solution was working perfectly for quite some time, but now I have to SUM only the visible ones. I've tried to use Subtotal, but with no succes. Is there a way to both use Subtotal (or some other function) and at the same time have this complicated SUM still working properly? THanks!
 
Upvote 0

Forum statistics

Threads
1,215,022
Messages
6,122,726
Members
449,093
Latest member
Mnur

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