Add two combinations of numbers with Excel formula

kelly mort

Well-known Member
Joined
Apr 10, 2017
Messages
2,169
Office Version
  1. 2016
Platform
  1. Windows
In A1 I will input number of items say 30 or whatever.

Then A2 will contain target price

Inside A4 I have a unit price of items.
Then A5 contains a different unit price for same items.

Now I want a way to add different combinations of the two unit prices to give me my target price.

And I want those numbers appear in B4 and B5 respectively.

I need formulas for that.

Hope someone can fix that for me.

Thanks
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
So you want a solution to the system of equations

B4 + B5 = A1
and
A4*B4 + A5*B5 = A2

B4 = A1-B5

A4*(A1-B5)+A5*B5 = A2

(A5-A4)*B5 = A2 - A4*A1

B5 = (A2-A4*A1)/(A5-A4)
B4 = A1-B5

unless, I've made an error in algebra.
 
Upvote 0
So you want a solution to the system of equations

B4 + B5 = A1
and
A4*B4 + A5*B5 = A2

B4 = A1-B5

A4*(A1-B5)+A5*B5 = A2

(A5-A4)*B5 = A2 - A4*A1

B5 = (A2-A4*A1)/(A5-A4)
B4 = A1-B5

unless, I've made an error in algebra.



Yeah. I wanna know if it is possible .

And sorry for late reply. My network went down.
 
Upvote 0
Yeah. I wanna know if it is possible .
Mike gave you the answer in his post...
So you want a solution to the system of equations

B4 + B5 = A1
and
A4*B4 + A5*B5 = A2


B4 = A1-B5

A4*(A1-B5)+A5*B5 = A2

(A5-A4)*B5 = A2 - A4*A1

B5 = (A2-A4*A1)/(A5-A4)
B4 = A1-B5
The red part is the two equation to solve and the blue part is the line-by-line algebraic manipulations to produce the last two lines which are your solution.
 
Upvote 0

Forum statistics

Threads
1,224,824
Messages
6,181,186
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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