+ Reply to Thread
Results 1 to 12 of 12

computations within conditional criteria list extraction - eliminating helper columns

  1. #1
    Registered User
    Join Date
    09-22-2011
    Location
    New Jersey
    MS-Off Ver
    Excel 2010
    Posts
    38

    computations within conditional criteria list extraction - eliminating helper columns

    I’ve been thinking about this problem off and on for quite a while, now that I’ve learned a bit more in Excel it’s time to redesign a performance spreadsheet which I use frequently. I’ve always resorted to sorting/filtering manually then copying and pasting into my destination cells which have various formulas set up to perform calculations on the filtered items/list. However I feel as if I’m on the verge of making this a less tedious process if I can figure a few things out.
    The long way:
    I set up a very simplified dummy spreadsheet compared to the ‘real data’; I import the correct activity records into my destination/calculation sheet. The criteria for which lines need to move are certain activities (withdrawals and deposits) that fall in a particular date range. I have a named range for these codes, “activity_codes”. I’m pretty good with vlookup and sumifs, index/match I’m getting better at and I have used Sumproduct with arrays but I don’t fully understand it yet (although I do understand matrix math, just not in Excel )….
    The efficient way:
    My ultimate goal is to get a time weighted performance number for a given period. I got that formula down. However there is one component of the performance calculation I would love to arrive at without sorting/filtering/copy/paste or using helper columns if possible. I’m currently stuck on trying to arrive at a sum of time weighted cash flow (WtdCF) without using helper columns. I really just want to design my sheet so that I can upload or reference the raw data without having to copy/paste helper column formulas each time. It’s probably easiest to inspect the time wieghted formulas written in my example. I have a feeling if this is possible the answer will further my knowledge of sumproduct and use of array formulas in Excel.

    Thanks in advance for a fruitful discussion
    Attached Files Attached Files

  2. #2
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: computations within conditional criteria list extraction - eliminating helper columns

    There's a lot going on here. Let's start with the basics.

    J19 can be a SUMIF, but here's the formula as a SUMPRODUCT which helps illustrate its flexibility:

    Please Login or Register  to view this content.
    Also note that when writing long formulas, it's good to get into the habit of inserting line breaks with Alt+Enter and using spaces to line up similar information.
    This is a 'best practice' to get in the habit of as it will make your life easier, help others assist you, and get your ready for the day you cross into VBA.

    I've also included a basic SUMPRODUCT tutorial to get you pointed in the right direction.


    All of that aside, your old process isn't necessarily bad.. but the basic concept could be improved perhaps by implementing INDEX(..SMALL( to automatically copy over only the relevant data without the need for manual copy and paste.
    Attached Files Attached Files
    Make Mom proud: Add to my reputation if I helped out!

    Make the Moderators happy: Mark the Thread as Solved if your question was answered!

  3. #3
    Registered User
    Join Date
    09-22-2011
    Location
    New Jersey
    MS-Off Ver
    Excel 2010
    Posts
    38

    Re: computations within conditional criteria list extraction - eliminating helper columns

    the sum of weighted cash flow is arrived at by taking each relevant activity (need a date and cash flow amount as well), figure out the total number of days into the date range that the activity occurs, add 1 and subtract that number from the total number of days in the date range. Then multiply that number by the cash flow amount then divide by the total number of days in the date range, the resulting number will be the weighted cash flow of that particular activity. I want to arrive at a summation of the weighted cash flows of all the relevant activity in the given date range. my spreadsheet solves this but with the use of helper columns, hopefully there is a way to eliminate the use of the helper columns.

  4. #4
    Valued Forum Contributor nigelbloomy's Avatar
    Join Date
    11-06-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    1,011

    Re: computations within conditional criteria list extraction - eliminating helper columns

    Your questions in cell J20 and J21 are solved here: http://www.excelforum.com/excel-form...med-range.html
    Basically you created an array when you decided to use a named range or list as the criteria. You just need to add =SUMPRODUCT() around your SUMIF() and it will work.

  5. #5
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: computations within conditional criteria list extraction - eliminating helper columns

    It took a few minutes, but essentially you take your helper columns, and then bend the single cell calculations into array logic.
    Like algebra, but now you're building a more complex X.

    Let's assume you have 10 rows of data. If C = A + B, then C is now (A2:A10+B2:B10)

    If D = C / B, then D = (A2:A10+B2:B10) / B2:B10

    And so on..

    Column E is really =data!A2:A19-DATE(YEAR(data!A2:A19),1,1)+1
    and F is now =((Total_Days_In_Period-(data!A2:A19-DATE(YEAR(data!A2:A19),1,1)+1+1))*data!C2:C19)/Total_Days_In_Period

    Building on the formula from before, Sum of WtdCF =
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    09-22-2011
    Location
    New Jersey
    MS-Off Ver
    Excel 2010
    Posts
    38

    Re: computations within conditional criteria list extraction - eliminating helper columns

    Thanks for the quick reply and the helpful help sheet. I will study it tonight. I didn't know you can use line breaks like that in the formula space.

    I've been slowly dabbling in VBA, I can usually follow along a pre written code or recorded macro and make minor adjustments/cell references. It doesn't come natural just yet.

    Also I was originally thinking haveing something that would automatically copy over the relevant lines .... just didn't know how. I'll research the Index(....small(

  7. #7
    Valued Forum Contributor nigelbloomy's Avatar
    Join Date
    11-06-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    1,011

    Re: computations within conditional criteria list extraction - eliminating helper columns

    Attachment 394546

    In this sheet you still need the helper columns in the Data tab, but because of the formulas in column K, you don't need to copy and paste anything. The formulas do all of the filtering and sorting for you.

  8. #8
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: computations within conditional criteria list extraction - eliminating helper columns

    Here's a little walkthrough to get you from point A to point B.
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    09-22-2011
    Location
    New Jersey
    MS-Off Ver
    Excel 2010
    Posts
    38

    Re: computations within conditional criteria list extraction - eliminating helper columns

    this works like a charm! I'll mark this thread solved but I may post some follow questions after I review some of the other Ideas mentioned. thanks again!

  10. #10
    Registered User
    Join Date
    09-22-2011
    Location
    New Jersey
    MS-Off Ver
    Excel 2010
    Posts
    38

    Re: computations within conditional criteria list extraction - eliminating helper columns

    There are some really great Ideas here, I like your helper files, as I’m taking the sample solution and re building the ‘real’ sheet …(there are actually several instances of the calculation table since it’s taking data from multiple sources, the formats and activity codes are completely different in each source).. it’s helping reinforce how everything works. Nigelbloomy even simplified some of my date math with named ranges I already had in place

    As I stumble through trial and error (fixing #name? and # value errors) I have a few follow up questions. For now I’m focusing on the Sum of weighted cash flow single cell formula, I’m saving the index /small idea for completely different sheet/problem where that will likely work wonders .

    In the first part of the Sumproduct formula, where you are testing the array to match each of the desired codes individually to get the True/False/1/0 array; do you have to test each code individually? Meaning that potentially my activity code list could be much larger than a handful of codes, for instance there could be hundreds of codes I want to ‘look’ for. Is there a way to get to the true/false/1/0 array using a named range of the activity codes I’m interested in?

    I’m trying to build this so that when I get new/fresh activity data, I just upload it into the data tab (in the future I may just wind up referencing a location where the data is stored). Potentially the activity data dimensions could vary greatly. Your formula was giving the array dimension of 2:5000, which will likely be sufficient for current needs, but I could also envision a greater scale where 5000 would be miniscule. Is it not possible to just reference a whole column? Do you always have to eliminate the header row? For now I’m just going to use named ranges and change the dimensions as needed,… just trying to know more about what you can and can’t do. Thanks again!

  11. #11
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: computations within conditional criteria list extraction - eliminating helper columns

    I am unfamiliar with a means to test multiple values in SUMPRODUCT, but SUMIF can handle the named range of those values all at once just fine. It's one of the few thing which SUMIF/COUNTIF can do better. They're also a better at ignoring strings and blanks. SUMPRODUCT can do it, it's just messier.

    Where SUMPRODUCT really shines is when you nest in other expressions into its parameters.

    When possible, always try to use row references or you will be calculating against all 1.04 million rows. Even if you specify 2:100000 you're still calculating only 10% of A:A. If you used full-column references in a more than maybe hundred complex formulas, you'll begin to notice significant performance impact. The workbook will take extra time to open, extra time to save, and extra time to do just about everything.

  12. #12
    Registered User
    Join Date
    09-22-2011
    Location
    New Jersey
    MS-Off Ver
    Excel 2010
    Posts
    38

    Re: computations within conditional criteria list extraction - eliminating helper columns

    I did some experimenting, and I have experienced the latency issues with expanded dimensions. Since I want this sheet to perform other tasks I will have keep the array dimensions to a reasonable minimum.

    A note to others following along: to avoid #value errors, when you set up named ranges that will be part of the array logic be sure to leave out header rows!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 1
    Last Post: 02-05-2015, 10:45 AM
  2. [SOLVED] Get rid of helper columns
    By YasserKhalil in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-24-2014, 05:26 PM
  3. conditional extraction of text values from a list
    By mischge in forum Excel General
    Replies: 6
    Last Post: 08-19-2013, 09:23 AM
  4. Conditional Formatting every other group of rows WITHOUT HELPER COLUMNS
    By distribution master in forum Excel General
    Replies: 1
    Last Post: 05-14-2013, 03:46 PM
  5. Helper columns
    By Blake 7 in forum Excel General
    Replies: 3
    Last Post: 02-23-2011, 06:42 AM

Tags for this Thread

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