+ Reply to Thread
Results 1 to 10 of 10

Need formula to solve first occurance

  1. #1
    Registered User
    Join Date
    08-09-2013
    Location
    dallas, tx
    MS-Off Ver
    Excel 2010
    Posts
    4

    Exclamation Need formula to solve first occurance

    Hello, I need two formulas to help me solve below scenario.

    1. A sum for the first occurrence of total price of each item times the price, i.e. (apple will be 2). So there is two 5s in the price, how should i write a formula to omit the second 5?
    2. A sum of the first occurrence of the total price of each item in the corresponding season, i.e.(watermelon in summer will be 5, watermelon in fall will be 10. In the above, watermelon will be 15 as it will not constitute the season).

    Please help!

    Items Season Price
    Apple fall 2
    peach summer 5
    banana fall 3
    watermelon summer 5
    watermelon fall 10

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,946

    Re: Need formula to solve first occurance

    Hi and welcome to the forum

    Take a look at using the sumifS() function for this? (it wont work is you have multiple entries for "apple" though)
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Forum Contributor
    Join Date
    06-26-2013
    Location
    Makati
    MS-Off Ver
    Excel 2010
    Posts
    138

    Re: Need formula to solve first occurance

    Hi jnj,

    I dont really understand what you want to achieve but try see attached file, if its doesnt solve your problem try to put your expected result and post it to the forum so it will be easier to understand.

    Book2.xlsx

  4. #4
    Registered User
    Join Date
    08-09-2013
    Location
    dallas, tx
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Need formula to solve first occurance

    Guys - appreciate your help but that's not the right formulas I am looking for. And sorry to confuse you. See attached spreadsheet and that might help you understand what I am try to achieve better.

    Thanks!
    Last edited by jnj; 08-09-2013 at 09:45 AM.

  5. #5
    Valued Forum Contributor
    Join Date
    05-20-2013
    Location
    Ohio, USA
    MS-Off Ver
    Excel 2013
    Posts
    941

    Re: Need formula to solve first occurance

    IMO you'll have to elaborate on your needs. To state you need as the sum of first occurence (i.e. singular, not plural as in more than one instance) is essentially a mathematical oxymoron. In mathematics terminology, the sum of first occurance is always the value of first occurence.

  6. #6
    Forum Contributor
    Join Date
    06-26-2013
    Location
    Makati
    MS-Off Ver
    Excel 2010
    Posts
    138

    Re: Need formula to solve first occurance

    Agree with jhren.

    @ jnj: please put your expected results manually on your sample sheets, and try to explain how you get that result, put more example on the sheet if necessary to explain the condition for your expected results.

  7. #7
    Registered User
    Join Date
    08-09-2013
    Location
    dallas, tx
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Need formula to solve first occurance

    Okay guys- I put my expected results on the sheet, hopefully that clarify. Thanks.
    Last edited by jnj; 08-09-2013 at 09:46 AM.

  8. #8
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Need formula to solve first occurance

    Hi,

    So basically you just want the results of your existing formulas returned, but only for the first such occurence?

    Simply add a condition in front of your existing formulas, e.g. in cell J3 and copy down:

    =IF(ROWS($1:1)=MATCH(A3,$A$3:$A$13,0),SUMIF($A:$C,A3,$C:$C),0)

    In M3 and copy down:

    =IF(ROWS($1:1)=MATCH(A3&B3,INDEX($A$3:$A$13&$B$3:$B$13,,),0),SUMIFS($C:$C,$A:$A,A3,$B:$B,B3),0)

    There's probably far simpler methods.

    Regards
    Click * below if this answer helped

    Advanced Excel Techniques: http://excelxor.com/

  9. #9
    Registered User
    Join Date
    08-09-2013
    Location
    dallas, tx
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Need formula to solve first occurance

    thanks. works like magic!!

  10. #10
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Need formula to solve first occurance

    You're welcome.

+ 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. [SOLVED] Formula to count the occurance of values seperated by a comma
    By bouncingbudha in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-02-2013, 10:23 PM
  2. [SOLVED] Formula to find the latest date of a specified occurance
    By happyhorse in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 01-16-2013, 12:37 PM
  3. Need Formula which sums up value for each occurance.
    By Karthik Sen in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-25-2012, 08:12 AM
  4. Finding last occurance as Non-array formula?
    By ratboy505 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-12-2007, 05:45 PM
  5. Need Formula for Last Occurance
    By Reignman in forum Excel Formulas & Functions
    Replies: 26
    Last Post: 09-06-2005, 03:05 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