ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   How do you insert a macro into a formula? (https://www.excelbanter.com/excel-discussion-misc-queries/118542-how-do-you-insert-macro-into-formula.html)

Obe

How do you insert a macro into a formula?
 
I wish to write a formula that goes to the end value in a column and uses
that value for multiplying another cell.

I am trying to multiply cell a7 by the last entry in the range c3:c20. I
have the macro that goes to that entry but now need the steps to insert it
into the formula. At the start of the month only cell c3 has data. On the
second day c4 has data and so on.

Thanks

Bob Phillips

How do you insert a macro into a formula?
 
=A7*LOOKUP(2,1/(C3:C20<""),C3:C20)

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Obe" wrote in message
...
I wish to write a formula that goes to the end value in a column and uses
that value for multiplying another cell.

I am trying to multiply cell a7 by the last entry in the range c3:c20. I
have the macro that goes to that entry but now need the steps to insert it
into the formula. At the start of the month only cell c3 has data. On the
second day c4 has data and so on.

Thanks




paul

How do you insert a macro into a formula?
 
if all you want to do is always multply a number by the last entry in a range
you dont need a macro....
something like =A7*INDEX(C3:C20,COUNT(C3:c20))
--
paul

remove nospam for email addy!



"Obe" wrote:

I wish to write a formula that goes to the end value in a column and uses
that value for multiplying another cell.

I am trying to multiply cell a7 by the last entry in the range c3:c20. I
have the macro that goes to that entry but now need the steps to insert it
into the formula. At the start of the month only cell c3 has data. On the
second day c4 has data and so on.

Thanks


Stefi

How do you insert a macro into a formula?
 
=A7*INDIRECT("C"&COUNT(C3:C20)+2)

Regards,
Stefi

€žObe€ť ezt Ă*rta:

I wish to write a formula that goes to the end value in a column and uses
that value for multiplying another cell.

I am trying to multiply cell a7 by the last entry in the range c3:c20. I
have the macro that goes to that entry but now need the steps to insert it
into the formula. At the start of the month only cell c3 has data. On the
second day c4 has data and so on.

Thanks


Lori

How do you insert a macro into a formula?
 
=A7*LOOKUP(9E+99,C:C)


Bob Phillips wrote:

=A7*LOOKUP(2,1/(C3:C20<""),C3:C20)

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Obe" wrote in message
...
I wish to write a formula that goes to the end value in a column and uses
that value for multiplying another cell.

I am trying to multiply cell a7 by the last entry in the range c3:c20. I
have the macro that goes to that entry but now need the steps to insert it
into the formula. At the start of the month only cell c3 has data. On the
second day c4 has data and so on.

Thanks



Swingstage

How do you insert a macro into a formula?
 
The answer to this question will also solve my problem so if there is a way
to place a macro into a formula please what is it?

"Obe" wrote in message
...
I wish to write a formula that goes to the end value in a column and uses
that value for multiplying another cell.

I am trying to multiply cell a7 by the last entry in the range c3:c20. I
have the macro that goes to that entry but now need the steps to insert it
into the formula. At the start of the month only cell c3 has data. On the
second day c4 has data and so on.

Thanks




Bob Phillips

How do you insert a macro into a formula?
 
If you create a UDF, it can be called directly from a worksheet formula.

For example

Function myFunc(rng As Range)
myFunc = rng.Cells.Count
End Function

and use like

=IF(myFunc(A1:A10)1, "Y","N")

these UDFs can only return a value, they cannot alter the worksheet/cells.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Swingstage" wrote in message
...
The answer to this question will also solve my problem so if there is a

way
to place a macro into a formula please what is it?

"Obe" wrote in message
...
I wish to write a formula that goes to the end value in a column and uses
that value for multiplying another cell.

I am trying to multiply cell a7 by the last entry in the range c3:c20. I
have the macro that goes to that entry but now need the steps to insert

it
into the formula. At the start of the month only cell c3 has data. On

the
second day c4 has data and so on.

Thanks






Pete_UK

How do you insert a macro into a formula?
 
This is from Chip Pearson's site, specifically:

http://www.cpearson.com/excel/differen.htm

" ...
Generally, you cannot call a macro directly from a worksheet cell. For
example, the following code does not work: =IF(A110,MyMacro).

You can simulate the statement =IF(A110,MyMacro) by using the
worksheet's Change event.

Private Sub Worksheet_Change (ByVal Target As Excel.Range)
If Target = [A1] Then
If Target.Value 10 Then
MyMacro
End If
End If
End Sub

...."

Hope this helps.

Pete

Swingstage wrote:

The answer to this question will also solve my problem so if there is a way
to place a macro into a formula please what is it?

"Obe" wrote in message
...
I wish to write a formula that goes to the end value in a column and uses
that value for multiplying another cell.

I am trying to multiply cell a7 by the last entry in the range c3:c20. I
have the macro that goes to that entry but now need the steps to insert it
into the formula. At the start of the month only cell c3 has data. On the
second day c4 has data and so on.

Thanks




All times are GMT +1. The time now is 08:53 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com