ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Excel formula (https://www.excelbanter.com/excel-worksheet-functions/193039-excel-formula.html)

azarat

Excel formula
 
I regularly use the formula =sum()-sum(). My question is how or can I create
a formula shortcut and to just fill in between the brackets to complete my
equation. I would like the shortcut to be readily available instead of always
having to retype it in. Can a shortcut be placed on a toolbar or within the
autofil shortcut on toolbar.
Thank you.

Bob Phillips

Excel formula
 
Once you type the =SUM( you are in edit mode so you cannot invoke the
shortcut at that point. You would have to writ e a macro to return the whole
formula.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"azarat" wrote in message
...
I regularly use the formula =sum()-sum(). My question is how or can I
create
a formula shortcut and to just fill in between the brackets to complete my
equation. I would like the shortcut to be readily available instead of
always
having to retype it in. Can a shortcut be placed on a toolbar or within
the
autofil shortcut on toolbar.
Thank you.




Bernard Liengme

Excel formula
 
Two alternatives
1) a UDF
Function diff(r1, r2)
For j = 1 To r1.Count
diff = diff + r1(j)
Next j
For j = 1 To r2.Count
diff = diff - r2(j)
Next j
End Function

call with =DIFF(B1:B5,A1:A5)
the two ranges need not be the same size

2) =SUMPRODUCT(r1-r2) as in =SUMPRODUCT(A1:A5-B1:B5)
the two ranges must be the same size
--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email

"azarat" wrote in message
...
I regularly use the formula =sum()-sum(). My question is how or can I
create
a formula shortcut and to just fill in between the brackets to complete my
equation. I would like the shortcut to be readily available instead of
always
having to retype it in. Can a shortcut be placed on a toolbar or within
the
autofil shortcut on toolbar.
Thank you.




Rick Rothstein \(MVP - VB\)[_782_]

Excel formula
 
I wonder if there is any break-even point for the number of cells covered by
the ranges after which this UDF might become more efficient than the one you
proposed?

Function DIFF(R1 As Range, R2 As Range) As Double
DIFF = Application.WorksheetFunction.Sum(R1) - _
Application.WorksheetFunction.Sum(R2)
End Function

Rick


"Bernard Liengme" wrote in message
...
Two alternatives
1) a UDF
Function diff(r1, r2)
For j = 1 To r1.Count
diff = diff + r1(j)
Next j
For j = 1 To r2.Count
diff = diff - r2(j)
Next j
End Function

call with =DIFF(B1:B5,A1:A5)
the two ranges need not be the same size

2) =SUMPRODUCT(r1-r2) as in =SUMPRODUCT(A1:A5-B1:B5)
the two ranges must be the same size
--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email

"azarat" wrote in message
...
I regularly use the formula =sum()-sum(). My question is how or can I
create
a formula shortcut and to just fill in between the brackets to complete
my
equation. I would like the shortcut to be readily available instead of
always
having to retype it in. Can a shortcut be placed on a toolbar or within
the
autofil shortcut on toolbar.
Thank you.





Spiky

Excel formula
 
On Jun 29, 6:49 am, azarat wrote:
I regularly use the formula =sum()-sum(). My question is how or can I create
a formula shortcut and to just fill in between the brackets to complete my
equation. I would like the shortcut to be readily available instead of always
having to retype it in. Can a shortcut be placed on a toolbar or within the
autofil shortcut on toolbar.
Thank you.


Maybe you need a template file already set up with your formulas
instead of VBA code to constantly re-create them.


All times are GMT +1. The time now is 10:03 AM.

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