Multiply Two Matrices With MMULT Macro

Apr 4, 2008

I have two ranges: A1:F1 and A5:A10, 6 elements in each range. When I multiply one by the other I have to enter a formular in some cell (let's say, A14 - we will put the result there): "=MMULT(A1:F1, A5:A10)" and then press Ctrl-Shift-Enter. Very simple.

Question is this: suppose I do not know in advance that I will have 6 elements in each vector, it might be more than 6 or less than six. I will introduce an integer "n", which is the number of elements. Now I have to write a Sub that will perform multiplication. I wrote smth that does not work and I was wondering if someone has ever done this already and can give me a guidance what I am doing wrong. I HAVE ONE CONSTRAINT: I HAVE TO TYPE IN THE FORMULA INTO THE SPREADSHEET VIA VBA (as this will be used further in Solver, which requires formulas to be present in cells).

Y
Sub test()
Dim n
n = 2
Range("A14").Formula = "=MMULT(A1: & Chr(64+n-1)& 1, A5:A & 5+n-1)"
End Sub

I thought it would be equivalent to MMULT(A1:B1, A5:A6).

View 2 Replies


ADVERTISEMENT

MMULT & ISERROR In Array Formula

Dec 31, 2006

I am trying to use an ISERROR function in an array formula, but it doesn't seem to be working. The formula I am using is as follows: ={IF(ISERROR(MMULT(Covar1,MMULT(MINVERSE(BC111:CX158),E161:E208))),0,MMULT(Covar1,MMULT(MINVERSE(BC111:CX158),E161:E208)))}

View 6 Replies View Related

Invert Matrix Mmult & Minverse

Jan 5, 2007

I was wondering if there was a way to show how many characters you have typed in a cell (as you type) either with a msgbox or a formula? It needs to display the Character Count live AS YOU ARE TYPING.

View 4 Replies View Related

Excel 2000 - If A1 Equal Or Less Than 1000 Multiply By B1 Otherwise Multiply By C1

Oct 30, 2013

Excel (2000), what formula would I use to accomplish the following?

If A1 equal or less than 1000 value, multiply by B1, otherwise multiply by C1.

View 9 Replies View Related

Dynamic Correlation Matrices

Sep 15, 2014

I have a table that I add rows to via a macro. I am trying to add correlation matrices that find the last row of the table, and include a certain number of rows above that to create a rolling correlation. For example, if I want the 2 week correlation, I would like the last 10 rows of data, but if I add another row, this formula should move down to incorporate the new row and deselect the now 11th day preceding. I do this manually but it is very time consuming.

View 9 Replies View Related

Inverse And Multiplication Of Matrices In VBA

Nov 30, 2008

1) I have declared:

Mtrx(20,20) as Integer, where i have a Matrix

1 2 3
1 2 3

How can I do an inverse of this matrix using only VBA commands?

2) I have :
Mtrx(20,20) as Integer, for example :

3 1
2 0

and Mtrx1(20,20) as Integer :
1 2 0
0 1 1

How to multiply these matrices using only VBA ?

View 9 Replies View Related

Solving Multiplication Of Two Matrices With Entries Decimal

Mar 16, 2014

Problem solving multiplication of two matrices with entries decimal in vba code:

Code:
Option Explicit

Public MatrixA(30, 30) As Long
Public MatrixB(30, 30) As Long
Public MatrixC(30, 30) As Long
Public RowA As Integer
Public ColA As Integer
Public RowB As Integer
Public ColB As Integer

Function ProperMaticesSizes() As Boolean

[Code] .........

View 1 Replies View Related

Using Matrices In Formulas, Using Letters As Input In Userforms

May 27, 2006

I have a matrix with default probabilities. I have this matrix in my worksheet. The user will give the number of periods to be calculated with and it will result in a new matrix with default periods over time of choice.

Private Sub UserForm_Click()
Dim numberof_text_Change As Single
Dim initial_text_Change As Single

Range("U36:AC44").Select
Selection.FormulaArray = "=matrixpower(R[-10]C:R[-2]C[8],numberof_text.value)"
End Sub

matrixpower is a function that works perfectly well. It takes one matrix as an argument and the number of periods to use. It then simply computes the chosen number of powers of my matrix. I have a userform that has an inputbox called numberof_text which specifies the number of periods that the user wishes to use in calculating the chance of default. Hence I would like to use this variable as an argument in the formulaarray. This doesn't seem to work! I only get "#VALUE!" in every cell. If I replace "numberof_text.value" in the matrixpower function with a number it works fine. What to do?

What the function needs to do is take an argument which is the matrix I have on my spreadsheet. Take the number of times to take powers of the matrix and print it on a pre-specified place on the worksheet. If I cannot use variables with FormulaArrays, then is there another good way of choosing the matrix to use with "powermatrix"?

View 2 Replies View Related

Multiply The Value Of Strings/integers For An Output In A Function Macro

Nov 29, 2006

I am attempting to multiply the value of strings/integers for an output in a function macro. I know it's a simple question, but a simple answer would be suffice. I'm in the middle of a massive brain fart...

View 6 Replies View Related

Manipulating Matrices (set Zones And Convert It To Another Set Of Zones)

Feb 2, 2010

I have an origin and destination matrix with one set of zones and need to convert it to another set of zones. This involves combining some zones together. I tried a sum if, but it didnt work. I have done the calcs individually but will have to repeat the process so was looking for a wuicker, more efficient and less error risk!
Just to clarify, I have to convert a 23 by 23 matrix into a 14 by 14.

View 9 Replies View Related

Multiply Using VBA ...

Feb 7, 2009

How can I multiply a range with a value and put the value in another range, using VBA ?

I have in some cases 2000 -3000 rows and I need to automate the process.

Please open attached file!

View 6 Replies View Related

Multiply Via VBA

May 22, 2008

I have a table with data which I have entered with VBA, now the only thing missing is multiply column D with column E.

When the data gets put into the table I like the data in column E to be multiplied with the date from column D.

View 9 Replies View Related

Multiply According To SUM Value

Aug 10, 2006

I am having trouble creating a formaula to calculate value based on the sum of a cell. For example if the sum of cell A1 is <= 149 I need to multiply the sum by 1.0
if the sum of cell A1 is 150-199 I need to multiply the sum by 1.50, if the sum of cell A1 is 200-249 I need to multiply the sum by 1.75, and if the sum of A1 is >= to 250 I need to multiply the sum by 2.00

View 3 Replies View Related

Multiply The Diference By 20%

May 18, 2009

b25
if the amount in b7 is the same or less than 7495 i need it to be multiplied by 10%

b26
if the amount in b7 is greater than 7495 then i need it to multiply the diference by 20%

View 14 Replies View Related

Automatically Multiply A Value

Mar 12, 2009

I want to be able to enter a value into a cell (within a specified range if necessary) and have it automatically multiply by a set value and overwrite the original entry with the result so making it all happen within one cell.

View 9 Replies View Related

Multiply Range X 1

Jun 9, 2006

After ripping a .pdf report into Excel I am left with a variety of items in Column A, numbers as text, text, and blanks. I manually selected entire column and paste special multiply. Seems to have convereted blanks to zero, converted numbers stores as text to numbers, and ignored any text. Problem is writing macro to repeat the steps as will use the tool every period. I tried looping through the range

For Each C In myRange
C.Value = C.Value * 1
Next C

But this returns type mismatch error. So why did it work manually if won't work through the macro?

View 2 Replies View Related

Multiply Selection

Nov 11, 2006

I need the code for a macro that, with a selection, it multiplies the cell number by “x” amount, keeping the original cell format. I know I can do that using paste special but I prefer a macro to be able to use it on different spreadsheets.

View 9 Replies View Related

Multiply Then Subtract Value

Nov 27, 2006

I have 3 columns. A B and C. In column C I want to input the answer to a formula into each cell using data from cells in their respective rows,

For. e.g.

Cx= Ax- (Bx X 0.8).

I want to be able to input this formula somewhere that will automatically fill out the cells in column C.

Column C is 20 cells long so x would range from 1 to 20.

View 5 Replies View Related

Sum Array & Multiply

Mar 2, 2008

I'm having difficulty in summing multiple rows (order volume) over many columns (despatched volume) that have a specific constant (price for the week).

Please see spreadsheet attached. I would like row 19 to be achieved as one line, thus removing rows 14-18. see logic in rows 14-18 which drives the row 19 result.

The problem is the volume is over 52 row and the price is over 1 row. Cannot think straight as to how to build the array. No VBA as the result needs to be transparent from a formula.


I'm having difficulty in summing multiple rows (order volume) over many columns (despatched volume) that have a specific constant (price for the week).

see spreadsheet attached. I would like row 19 to be achieved as one line, thus removing rows 14-18. Please see logic in rows 14-18 which drives the row 19 result.

The problem is the volume is over 52 row and the price is over 1 row. Cannot think straight as to how to build the array. No VBA please as the result needs to be transparent from a formula.

View 9 Replies View Related

Add & Subtract Time, Then Multiply By $

Feb 8, 2009

I have a cell that is "Start Time." Another is "End Time." And, of course, "Total."
The sum listed in "Total" is multiplied by a cost per hour. Except it does not work. I have attached an example copied directly from the cost sheet.

View 3 Replies View Related

Multiply If Column Contains Certain Text?

Aug 8, 2014

I have column A that declares the account as asset, liability, expense, etc. Some of the accounts need to be reversed. I'm having a hard time figuring out a formula or code I can use. Column C contains the values. I prefer VBA as I want to add it to the current macro I already have.

So if Column A has a liability, offset by (0,2), and multiply that value by -1. If Column A has an asset, leave the value as is.

I wanted to use an if-then statement but I'm not sure how to highlight entire columns. The number of liabilities, and assets, etc.

View 7 Replies View Related

User Input To Multiply

Apr 15, 2009

In my macro, I'm trying to use an input box to determine the factor to multiply another cell by. I also want to only allow entry of 6.0 or less, and only allow, (but not require), a single decimal place. Here's what I've got so far, but it's not working:

View 2 Replies View Related

Formatting UserForm - Multiply

Jun 16, 2009

On my Userform i have 2 textboxes. Textbox2 needs to look at textbox1 and if the value in textbox1 is equal to or greater than 25000, then multiply that value in textbox1 by 0.0035 and place the value in textbox2.

View 4 Replies View Related

Multiply And Round In One Equation

Mar 1, 2007

I need to take a number, multiply it by a precentage, & then round it to the nearest multiple of 5.

ex:
A1=142.5
B2=A1*50%,(then rounded to nearest multiple of 5)

View 9 Replies View Related

OR Function: Multiply The Cell

Oct 24, 2009

I have a row where C5 is the total of C1:C4. What I am trying to do is if C1 or C2 or C3 or C4 has a number value that I can multiply the cell in question by 2 and then add up all of the cells to give a total in C5. Also, I have a name in A1, but when I select E1 and enter =A1 into the cell then return, I get A1 in the cell instead of the name in A1.

View 5 Replies View Related

Using Percentage In Text To Multiply By A Value

Aug 21, 2012

I have the following text in B5 "deposit fee 0.75%". I have a value of 3500 in B2. I would like a formula where a can multiply the value in B2 x the 0.75% that is contained in the text "deposit fee 0.75%"

I tried to use =B2*VALUE(MID(B5,17,1)), but it gives me #value

View 4 Replies View Related

VBA Multiply Only If Cell Is Not Blank?

Jul 14, 2014

I need a VBA macro to multiply column E and F and deposit the result in column G. The multiplication should only happen when there is a value in the column E. If there is no value in the column E, then the cell in the G column should stay blank.

View 9 Replies View Related

Multiply The Value Of Sheet1 And Sheet 2

Dec 9, 2009

I have 3 sheet.

i need to multiply the value sheet 1 and sheet 2.

Sheet1  AB1NameAmount2Kumar1003Siva2004Sasi3005kannan400 Excel tables to the web >> Excel Jeanie HTML 4

Sheet2  ABC1Name MonthComments2kannan5good customer3Kumar10average customer4Siva20ok5Sasi25not bad Excel tables to the web >> Excel Jeanie HTML 4

The answer should be like this

Sheet3  ABC1NameAmountComments2Kumar1000average customer3Siva4000ok4Sasi7500not bad5kannan2000good customer Excel tables to the web >> Excel Jeanie HTML 4

View 9 Replies View Related

Multiply Textbox Value And Combo Box Value

Jan 18, 2010

I need to multiply text box value and Combo box value, but facing with "Run time error-13,Type Mismatch"

Dim total as Integer
Me.txtQty.Value = ""
Me.txtAmount.Value = Total
Total = txtQty.Value * cboRate.Value

View 9 Replies View Related

Multiply Three Columns Of Numbers Together

Feb 23, 2010

I would like to multiply every number in one column with every number in another column with every number in a third column (columns A,B and C).

There are less than ten cells in each column.

View 9 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved