MMult & Transpose

CyFoo

New Member
Joined
Aug 19, 2011
Messages
10
Hi<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>
<o:p></o:p>
Have been reading the forum for Excel and VBA tips for the past few years and many thanks to everybody for your efforts in posting enquiries and answering them. It has been very informative.<o:p></o:p>
<o:p></o:p>
I have an enquiry on MMult & Transpose in Excel 2007.<o:p></o:p>
<o:p></o:p>
Have written some UDF and subs in VBA that auto generate the following equation from LinEst() function,<o:p></o:p>
= MMULT(A1^{0,3,2,1},TRANSPOSE({405019.817326055,-0.0195348471345153,-1.51284947109658,371.838931959456}))<o:p></o:p>
<o:p></o:p>
Theoretically, if A1 is 0, the equation should have returned 405019.817326055. Nevertheless, it returned #NUM! instead. This condition will only happen if A1 contained a 0.<o:p></o:p>
<o:p></o:p>
Can anyone please help or guide me to the relevant threads, please?
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
Hi

Like Glenn said 0^0 returns a number error.

In your case, it seems you'd like 0^0 to return 1?

In that case, add it to the formula:

= MMULT(IF((A1=0)*({0,3,2,1}=0),1,A1^{0,3,2,1}),TRANSPOSE({405019.817326055,-0.0195348471345153,-1.51284947109658,371.838931959456}))

This is an array formula, you have to confirm it with Ctrl-Shift-Enter.
 
Upvote 0
Thanks Glenn & pgc01

0^0 is indeed undefined in Excel, and pgc01's AND array is right on spot, output-ing {1,0,0,0} array directly.
IF((A1=0)*({0,3,2,1}=0)

great reply and many thanks!

:confused: just wondering if there is any built in excel error checking options that automatically output 0^0=1? it would make my function simpler and only need to make one cell reference.
imagine the output of a 16 variable regression model, with an IF( AND array ) for each variable, which makes a total of 32 cell references :eeek:
 
Upvote 0
Also, unless I'm missing something, I think the following should suffice...

=MMULT(IF((A1=0)*({0,3,2,1}=0),1,A1^{0,3,2,1}),{405019.817326055;-0.0195348471345153;-1.51284947109658;371.838931959456})

Hope this helps!
 
Upvote 0
Thanks Domenic for shortening the function string.

do you also have any suggestion for the following?
:confused: just wondering if there is any built in excel error checking options that automatically output 0^0=1? it would make my function simpler and only need to make one cell reference.
imagine the output of a 16 variable regression model, with an IF( AND array ) for each variable, which makes a total of 32 cell references :eeek:
<!-- / message -->
 
Upvote 0

Forum statistics

Threads
1,224,602
Messages
6,179,844
Members
452,948
Latest member
UsmanAli786

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