+ Reply to Thread
Results 1 to 8 of 8

value adding with condition.

  1. #1
    Registered User
    Join Date
    11-10-2016
    Location
    Sri Lanka
    MS-Off Ver
    2010
    Posts
    77

    value adding with condition.

    A column indicate time and B column is price. I will put D2 Time need to add all price in B2:B10.( less than d2 time)
    Example;

    Time .........Price
    1:27 ....... -0.313
    4:15 ....... -0.167
    7:58 ....... 0.119
    10:13 ...... -0.194
    8:39........ 0.306
    13:03 ....... 0.314
    14:21 ...... 0.326
    14:59 ...... 0.808
    15:16 .......1.694

    D2 time is 10.13, need to add -0.194+0.119+(-0.167)+(-0.313)=??????
    Attached Files Attached Files

  2. #2
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: value adding with condition.

    Try this...

    =SUMIF(A2:A10,"<"&D2,B2:B10)
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  3. #3
    Registered User
    Join Date
    11-10-2016
    Location
    Sri Lanka
    MS-Off Ver
    2010
    Posts
    77

    Re: value adding with condition.

    sir, i need
    if D2 time is 10.13, need to mines (-) count of less than zero and count of more than zero=??????

  4. #4
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,099

    Re: value adding with condition.

    Please calculate the answer manually for any set of values and tell us what you get. Why? Because, as far as I can tell, there is nothing wrong with Tony's answer.
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU

  5. #5
    Registered User
    Join Date
    11-10-2016
    Location
    Sri Lanka
    MS-Off Ver
    2010
    Posts
    77

    Re: value adding with condition.

    if time is 10.13,

    less than zero count = 3 ((-0.194),(-0.167)+(-0.313))
    more than zero count =1 (0.119)

    my answer = 3-1 =2

  6. #6
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,099

    Re: value adding with condition.

    OK. I understand now...

  7. #7
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: value adding with condition.

    Quote Originally Posted by nnish View Post
    if time is 10.13,

    less than zero count = 3 ((-0.194),(-0.167)+(-0.313))
    more than zero count =1 (0.119)

    my answer = 3-1 =2
    I thought you wanted a SUM total?


  8. #8
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,099

    Re: value adding with condition.

    One way:

    =COUNTIFS($A$2:$A$10,"<"&$D$2,$B$2:$B$10,"<0")-COUNTIFS($A$2:$A$10,">"&$D$2,$B$2:$B$10,"<0")

+ 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. adding a condition to a macro?
    By b_rianv in forum Excel Programming / VBA / Macros
    Replies: 25
    Last Post: 09-12-2014, 07:26 AM
  2. Adding another if condition to my macro
    By superboy in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-21-2014, 06:34 PM
  3. Adding another condition to my sum if function
    By superboy in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-08-2014, 01:30 PM
  4. Need help adding another condition to IF formula
    By gibson2503 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 10-28-2013, 10:03 AM
  5. [SOLVED] adding another condition in sumproduct
    By mattmorris in forum Excel General
    Replies: 4
    Last Post: 06-28-2012, 06:53 AM
  6. condition adding
    By choy96 in forum Excel General
    Replies: 8
    Last Post: 03-24-2010, 07:22 AM
  7. Adding with Condition
    By rizmomin in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 11-29-2008, 06:32 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