System of Equations

lxd

Board Regular
Joined
Sep 15, 2010
Messages
79
How can I develop a macro that solves a system of equations using Crammer's Rule or another feasible rule. I will like the macro to be able to handle as many as 6 equations. One (very hypothetical) example just to show what I am talking about.

10x + 5y + 2z = 10

15x + 2y + 20z = 30

Need help. Thanks a lot.
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
That problem is underdefined; you need three equations in three unknowns to solve exactly (if there is a solution). If you have more than that, it's overdefined, and you can solve for a best fit.

An example of a square system:
Code:
       --A-- --B-- --C-- D --E-- -------------------F-------------------
   1     x     y     z       w                                          
   2      10     5     2      10                                        
   3      15     2    20      30                                        
   4       5     1    12      40                                        
   5                                                                    
   6                 x   = -6.11 E6:E8: {=MMULT(MINVERSE(A2:C4), E2:E4)}
   7                 y   = 12.29                                        
   8                 z   =  4.86                                        
   9                             Check:                                 
  10                          10 E10: =MMULT(A2:C2, E$6:E$8)            
  11                          30                                        
  12                          40
 
Upvote 0
Yes, you are abosuletly right. I should have given the third equation. But did you give me the general purpose macro which solves any square system of equations? Thanks again.
 
Upvote 0
I gave you the general-purpose formula. Why write a macro to replace a formula that executes faster than a macro ever would?
 
Upvote 0
My idea was to create a user form for people with little knowledge of Excel array formulas. Just by entering values in text boxes and clicking a command button they can get results. That is why I was interested in a VB code.
 
Upvote 0

Forum statistics

Threads
1,216,109
Messages
6,128,883
Members
449,477
Latest member
panjongshing

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