Using CTRL to select cells for a formula
I don't think you can select some cells and then pass them onto any formula
chosen by you.
What you want, however, can be achieved with a simple macro as follows;
(Before running this macro select the cells you want and then run it [macro
can be assigned to a button or keyboard short cut]
Currently it calculates total, average and count of cells and puts them in
cells D1-D3. You may replace the logic within the loop to get other results.
Sub Cells_Loop()
Dim i As Range
Dim SumSelectedCells
SumSelectedCells = 0
For Each Cell In Selection
SumSelectedCells = SumSelectedCells + Cell.Value
Next
AverageSelectedCells = (SumSelectedCells / Selection.Count)
Range("D1").Value = SumSelectedCells
Range("D2").Value = SumSelectedCells / Selection.Count
Range("D3").Value = Selection.Count
'MsgBox ("TOTAL=" & SumSelectedCells & ", AVEARAGE=" & AverageSelectedCells
& ", COUNT=" & Selection.Count)
End Sub
"Elgee" wrote:
Hi -
I tried to search for help on this one before posting - but wasn't sure how
to search for my answer if that makes sense.
Essentially - I work with a very manual spreadsheet with a lot of various
data for project reporting. (Forecasts, Actuals, EAC, Variance etc.) Due to
the format / layout of the worksheet - I often need to use 'ctrl' to select
the cells I want to include in a formula. IE: =sum(f1, f3, f33, f35) etc.
Is it possible to back into a formula like that? IE: I click CTRL and
select the various cells I want to total and I can see that # in the status
bar at the bottom of the screen. Is there a way to copy those cells into a
formula?
Thanks!
|