Results 1 to 4 of 4

Building a summary report with ONE formula.

Threaded View

  1. #1
    Valued Forum Contributor
    Join Date
    01-19-2012
    Location
    Barrington, IL
    MS-Off Ver
    Excel 2007/2010
    Posts
    1,211

    Building a summary report with ONE formula.

    This is useful for periodic reports you need to build daily/weekly/monthly, that consist entirely of formulas, and especially helpful when there are numerous types of formulas.

    You can use a CHOOSE(COLUMN(), ) to do the job for you.

    An example:

    I have a sheet that has five columns, each with a unique formula that is copied down.

    B =INDEX(Sheet2!A2:A500,MATCH(A2,Sheet3!F2:F50000,0),0)
    C =SUM(B2,N(VLOOKUP(A2,Sheet3!C2:F500,3,0)))
    D =F2*1.07
    E =D2+SUM(A2:C2)
    F =VLOOKUP(A2,Sheet2!B2:F500,4,0)


    Ok. So my sheet has those formulas. When I have to build it each month, I either have to re-write them, or copy them one by one. Copying them might not be so bad, but what if you have 30 columns of formulas to make? That takes a little time, what if you mess it up?

    My solution requires you pay attention to the cell references, the $'s need to be in the right place for your application. For these formulas I just have to lock the columns down so they don't move about when I copy the formula across.

    Since I am starting in Column B, I want to set my COLUMN() in there to a 1, so;
    =CHOOSE(COLUMN()-1,

    Now simply paste all of your formulas in there, and fix the $'s so it copies correctly

    =CHOOSE(COLUMN()-1,INDEX(Sheet2!$A2:$A500,MATCH($A2,Sheet3!$F$2:$F$50000,0),0),SUM($B2,N(VLOOKUP($A2,Sheet3!$C$2:$F$500,3,0))),$F2*1.07,$D2+SUM($A2:$C2),VLOOKUP($A2,Sheet2!$B$2:$F$500,4,0))


    or, broken down,

    =CHOOSE(COLUMN()-1,INDEX(Sheet2!$A2:$A500,
    MATCH($A2,Sheet3!$F$2:$F$50000,0),0),
    SUM($B2,N(VLOOKUP($A2,Sheet3!$C$2:$F$500,3,0))),
    $F2*1.07,
    $D2+SUM($A2:$C2),
    VLOOKUP($A2,Sheet2!$B$2:$F$500,4,0))


    The choose function is limited to 254 places, so that's as many columns as can be included in this formula.

    -------------------

    If you want to get fancy, and have a similar formula occurring multiple times, you can make it shorter by nesting a VLOOKUP in there with a formula index lookup table based on Row number, using the returned value to choose the formula appropriate to you. This is a slightly modified version of this formula I have in use at the moment. It is working on 15 columns, with 9 different formula structures.


    =CHOOSE(VLOOKUP(COLUMN(),{1,0;2,1;3,1;4,2;5,3;6,4;7,1;8,0;9,1;10,1;11,5;12,6;13,7;14,8;15,9},2,0),VLOOKUP($A2,'Source'!$A:$I,MATCH(B$1,'Source File'!$A$1:$I$1,0),0),VLOOKUP($B2,T1!$A:$B,2,0),VLOOKUP($B2,T3!$B:$C,2,0),VLOOKUP($B2,T4!$A:$B,2,0),$J2*0.6,VLOOKUP($B2,T5!$A:$D,4,0),VLOOKUP($L2,T6!$B:$C,2,0),$K2*0.5,CONCATENATE("T", $B2, "-", $G2, "-", $L2))

    Broken down so you can see the formulas;

    =CHOOSE(VLOOKUP(COLUMN(),{1,0;2,1;3,1;4,2;5,3;6,4;7,1;8,0;9,1;10,1;11,5;12,6;13,7;14,8;15,9},2,0),
    VLOOKUP($A2,'Source'!$A:$I,MATCH(B$1,'Source File'!$A$1:$I$1,0),0),
    VLOOKUP($B2,T1!$A:$B,2,0),
    VLOOKUP($B2,T3!$B:$C,2,0),
    VLOOKUP($B2,T4!$A:$B,2,0),
    $J2*0.6,
    VLOOKUP($B2,T5!$A:$D,4,0),
    VLOOKUP($L2,T6!$B:$C,2,0),
    $K2*0.5,
    CONCATENATE("T", $B2, "-", $G2, "-", $L2))



    You can even get more fancy if your formulas change at a certain row by putting a second level of choose in there which looks at ROW()!


    Hope someone finds this useful.
    Last edited by Speshul; 10-16-2014 at 04:00 PM.
    You should hit F5, because chances are I've edited this post at least 5 times.
    Example of Array Formulas
    Quote Originally Posted by Jacc View Post
    Sorry, your description makes no sense. I just made some formula that looks interesting cause I had nothing else to do.
    Click the * below on any post that helped you.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Building a Summary Report
    By Matty5894 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-07-2014, 04:33 AM
  2. Convert Detailed Time Attendance report from Biometrics to Summary Report
    By firescorpio in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-02-2013, 02:48 AM
  3. [SOLVED] vba code or formula assistance to associate a date, text, and value to a summary report.
    By lilsnoop in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-01-2013, 10:52 AM
  4. Consolidated Report building using mega formula or VBA
    By excel5111987 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-17-2011, 09:18 AM
  5. Form Email from Report, Only if Report summary sheet lists Acct for that Sales Rep
    By lukep10 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-28-2008, 01:38 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1