Solved

Excel: GROWTH with Inverted Column

Posted on 2010-09-08
7
305 Views
Last Modified: 2013-11-10
I have the following column of numbers in F12:F18:

99.49
95.09
103.93
99.11
99.07
96.65
97.94

How do I construct a formula that effectively gives me =GROWTH(F18:F12)?

Best wishes,

John
0
Comment
Question by:jfdinneen
  • 5
  • 2
7 Comments
 
LVL 92

Expert Comment

by:Patrick Matthews
ID: 33628228
Simply select G12:G18, enter this formula:

=GROWTH(F12:F18)

and instead of hitting Enter, hit Ctrl+Shift+Enter (thus making it an array formula).

Excel will display it as:

{=GROWTH(F12:F18)}
0
 
LVL 92

Expert Comment

by:Patrick Matthews
ID: 33628238
Formatting to two decimal places, the above returns:

Original      Growth
99.49       99.38
95.09       99.16
103.93       98.94
99.11       98.72
99.07       98.50
96.65       98.28
97.94       98.06
0
 

Author Comment

by:jfdinneen
ID: 33628607
Patrick

Thanks for the prompt reply.

Unfortunately, I do not want to create a new column, just a single result in G12. Forgive my ignorance, GROWTH(99.49, 95.09, 103.93, 99.11, 99.07, 96.65, 97.94) = 99.38, but GROWTH(97.94, 96.65, 99.07,, 99.11, 103.93, 95.09, 99.49) = 98.07 - I want the latter. Please advise?

Best wishes,

John
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 92

Expert Comment

by:Patrick Matthews
ID: 33628743
I see now what you meant by "inverted".

As far as I know, you will either have to use a "helper" column, or use VBA to accomplish the inversion.  For example:

1) Put this formula in G12...

=INDEX($F$12:$F$18,COUNT($F$12:$F$18)-ROW(G1)+1)

2) Copy that through G18

3) In another cell, enter the formula...

=GROWTH(G12:G18)
0
 
LVL 92

Expert Comment

by:Patrick Matthews
ID: 33628844
Using VBA, I created the function below, which is intended to return an array that is the "reverse" of the range fed in.  It only works properly if the range has:

1) 1 column and 2+ rows OR
2) 2+ columns and 1 row OR
3) a single cell

I then got the expected result with:

=GROWTH(ReverseRange(F12:F18))



Function ReverseRange(rng As Range) As Variant
    
    Dim arr() As Variant
    Dim Counter As Long
    
    If rng.Rows.Count > 1 Then
        ReDim arr(1 To rng.Rows.Count, 1 To 1) As Variant
        For Counter = 1 To rng.Cells.Count
            arr(rng.Cells.Count - Counter + 1, 1) = rng.Cells(Counter)
        Next
    ElseIf rng.Columns.Count > 1 Then
        ReDim arr(1 To 1, 1 To rng.Columns.Count) As Variant
        For Counter = 1 To rng.Cells.Count
            arr(1, rng.Cells.Count - Counter + 1) = rng.Cells(Counter)
        Next
    Else
        ReDim arr(1 To 1) As Variant
        arr(1) = rng.Cells(1)
    End If
    
    ReverseRange = arr
    
End Function

Open in new window

0
 
LVL 92

Accepted Solution

by:
Patrick Matthews earned 500 total points
ID: 33628957
I like this version much better.  Handles ranges with >1 row and >1 column, and is simpler.

=GROWTH(ReverseRange(F12:F18)) still works.
Function ReverseRange(rng As Range) As Variant
    
    Dim arr() As Variant
    Dim Counter1 As Long
    Dim Counter2 As Long
    
    ReDim arr(1 To rng.Rows.Count, 1 To rng.Columns.Count) As Variant
    
    For Counter1 = 1 To rng.Rows.Count
        For Counter2 = 1 To rng.Columns.Count
            arr(rng.Rows.Count - Counter1 + 1, rng.Columns.Count - Counter2 + 1) = rng(Counter1, Counter2)
        Next
    Next
    
    ReverseRange = arr
    
End Function

Open in new window

0
 

Author Closing Comment

by:jfdinneen
ID: 33629130
Patrick,

Excellent result. Thanks for the benefit of your expertise.

Best wishes,

John
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A short article about a problem I had getting the GPS LocationListener working.
Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now