+ Reply to Thread
Results 1 to 8 of 8

Changing my SUMPRODUCT/MAX Formula to only search the first x number of rows!

  1. #1
    Forum Contributor
    Join Date
    05-04-2013
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    125

    Changing my SUMPRODUCT/MAX Formula to only search the first x number of rows!

    Hi,

    I have the formula below which retrieves the highest value within a range but only the one of the values in the range (Column x) is a negative. The formula works fine but I now need to change it to only return the value from the first 26 rows of data that it finds.

    My actual dataset contains multiple people each with >100 rows each, but I'm only interested in the first 26 rows.


    Please Login or Register  to view this content.
    I've had a try at offset or coutif but can't get it too work!

    Any ideas?

    Thanks in advance

  2. #2
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,788

    Re: Changing my SUMPRODUCT/MAX Formula to only search the first x number of rows!

    Attach a sample workbook. Make sure there is just enough data to make it clear what is needed. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are demonstrated, mock them up manually if needed. Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  3. #3
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,679

    Re: Changing my SUMPRODUCT/MAX Formula to only search the first x number of rows!

    When you say "first 26 rows of data" do you mean the first 26 for a specific customer.....or the first 26 rows which fulfil all the criteria (or something else)?

    Is the data sorted, does each customer appear in a single block?
    Audere est facere

  4. #4
    Forum Contributor
    Join Date
    05-04-2013
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    125

    Re: Changing my SUMPRODUCT/MAX Formula to only search the first x number of rows!

    Hi sixthsense and daddylonglegs,

    I've uploaded the sample workbook and basically there are two issues. The Sumproduct formula looks down the list to find the highest value , but in some cases this is outside of the first 26 rows of data (like in the example), any values outside of the 26 rows should be excluded, which is where I thought where the offset would come in etc.

    The second issue is the formula in Column W is returning the incorrect value if either the formula in Q is picking up data from outside of the 26, or if there are two identical values in the 26 rows (as it's picking the top one up but should be returning the value after the reduction).

    I figure I could get around this second issue by having a helper column display in which period the highest point pre-reduction appears, and I could then offset by one similiar to column W to display the next period.

    The dataset does have hundreds of lines for multiple people, however they are all sorted by column A and K, and therefore each dataset is together they are all together.

    Any help you can offer would be appreciated.

    Thanks

    David
    Attached Files Attached Files

  5. #5
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,679

    Re: Changing my SUMPRODUCT/MAX Formula to only search the first x number of rows!

    Try using AGGREGATE function to get the maximum value - this should work if there are always at least 26 instances of each name:

    =AGGREGATE(14,6,(OFFSET('Data Extract'!$A$1,MATCH($B7,'Data Extract'!$B$2:$B$6218,0),0,26)=$F7)*(OFFSET('Data Extract'!$X$1,MATCH($B7,'Data Extract'!$B$2:$B$6218,0)-1,0,26)<0)*OFFSET('Data Extract'!$W$1,MATCH($B7,'Data Extract'!$B$2:$B$6218,0),0,26),1)

  6. #6
    Forum Contributor
    Join Date
    05-04-2013
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    125

    Re: Changing my SUMPRODUCT/MAX Formula to only search the first x number of rows!

    Thanks daddylonglegs,

    That's a pretty amazing formula - very impressed. I've copied it into my workbook and it seems to work perfectly. Any idea how I can tell which period (Column K) that figure comes from (11/2013) in this case?

    Cheers David

  7. #7
    Forum Contributor
    Join Date
    05-04-2013
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    125

    Re: Changing my SUMPRODUCT/MAX Formula to only search the first x number of rows!

    Hey daddylonglegs/sixthsense,

    Sorry to repost but I still need some help solving the second part of the problem, namely finding the value of the cell 12 columns along from the value retrieved by the aggregate formula, well actually 12 along and 1 up (12/2013) in this case.

    Is there any way to retrieve that value by modifying the Aggregate formula. I've searched online looking at retrieving which cell a value comes from but the best answer under formula auditing isn't feasible as I need it for each example in my calc sheet (60+)

    Any help either of you can offer would be appreciated.

    Thanks

  8. #8
    Forum Contributor
    Join Date
    05-04-2013
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    125

    Re: Changing my SUMPRODUCT/MAX Formula to only search the first x number of rows!

    Hey Guys, just to let you know I've posted the question in the general forum, I hope that's ok.

    Thanks for the great assitance you've offered so far.

    Thanks

    David

+ 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. Can't get over certain number of rows for SUMPRODUCT formula
    By Matthew_TO in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-23-2013, 03:48 PM
  2. Changing the number of rows when variable rows are returned by macro
    By intj.inc in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-07-2012, 09:01 AM
  3. Autofil Sumproduct for different number of rows
    By mjhopler in forum Excel General
    Replies: 3
    Last Post: 09-13-2010, 04:25 AM
  4. SUMPRODUCT-formula with changing conditions
    By BCB in forum Excel General
    Replies: 2
    Last Post: 02-09-2009, 04:49 PM
  5. Replies: 4
    Last Post: 05-04-2005, 12:06 PM

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