+ Reply to Thread
Results 1 to 17 of 17

If condition for sum duplicate number

  1. #1
    Registered User
    Join Date
    04-04-2014
    Location
    India,Pune
    MS-Off Ver
    Excel 2013
    Posts
    99

    If condition for sum duplicate number

    Hi Team,

    The queries is continue.

    I have attached the one sheet and i have put formula in column "C".

    The formula is calculating if the hours in column "D" is =>120 then calculate as "1" & below 0 calculate as "0" and otherwise divide hours in column 'D" with "160" for USA & Philippines and for India "180".

    The issue for only the duplicate number (A9 to A11) if you check column D9 to D11 the hour total is 158 but the formula calculated sum 0.9875 in column C9 to C11.

    As my condition is if total hours is =>120 then it should calculated as "1". So can we modify this formula to calculate the total "1" for duplicate number if it is >=120?

    Thanks,
    Rahul
    Attached Files Attached Files
    Last edited by rchure; 10-12-2016 at 05:25 AM.

  2. #2
    Registered User
    Join Date
    04-20-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2010
    Posts
    23

    Re: If condition for sum duplicate number

    One work around would be to add some helper columns
    Attached Files Attached Files

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

    Re: If condition for sum duplicate number

    Quote Originally Posted by chrispittelli View Post
    One work around would be to add some helper columns
    https://www.excelforum.com/showthread.php?t=1040120



    ---------------------------
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  4. #4
    Registered User
    Join Date
    04-04-2014
    Location
    India,Pune
    MS-Off Ver
    Excel 2013
    Posts
    99

    Re: If condition for sum duplicate number

    Hi,

    Thanks for reply.

    In your formula duplicate number total is "3" column (C9 to C11) but i want this total to be "1".

    My goal is if duplicate number total is more than 120 then formula should calculate "1" but not in each duplicate line the total of duplicate line should be "1".

    Example- i have 4 duplicate line and its total is 150 (More than 120) then i want formula calculate "0.25" in each line so my total will be "1".

    Thanks,
    Rahul
    Last edited by rchure; 10-11-2016 at 10:25 PM.

  5. #5
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: If condition for sum duplicate number

    This seems to work. In E5 and down.

    =IF(COUNTIF($A$5:A5,A5)=COUNTIF($A$5:$A$51,A5),IF(SUMIFS($D$5:D5,$A$5:A5,A5)>=120,1,IF(SUMIFS($D$5:D5,$A$5:A5,A5)<0,0,SUMIFS($D$5:D5,$A$5:A5,A5)/IF(OR(B5={"USA","Philippines"}),160,IF(B5="India",180)))),"")
    Dave

  6. #6
    Registered User
    Join Date
    04-04-2014
    Location
    India,Pune
    MS-Off Ver
    Excel 2013
    Posts
    99

    Re: If condition for sum duplicate number

    Hi Dave,

    Thanks for the reply.

    Your formula calculating sum "1" for duplicate number at the end and other duplicate row number is blank but i want the number in every duplicate row which total should be "1".

    Example- i have 4 duplicate number and its total is 150 then i want formula calculate "0.25" in each duplicate line so my total will be "1".

    Thanks,
    Rahul

  7. #7
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: If condition for sum duplicate number

    Does this also mean that when the totals for duplicates are < 120 you still want to sum them and apply the division rule?

    Like this:

    =IF(COUNTIF($A$5:A5,A5)<=COUNTIF($A$5:$A$51,A5),IF(SUMIFS($D$5:$D$51,$A$5:$A$51,A5)>=120,1,IF(SUMIFS($D$5:$D$51,$A$5:$A$51,A5)<0,0,SUMIFS($D$5:$D$51,$A$5:$A$51,A5)/IF(OR(B5={"USA","Philippines"}),160,IF(B5="India",180)))))

  8. #8
    Registered User
    Join Date
    04-04-2014
    Location
    India,Pune
    MS-Off Ver
    Excel 2013
    Posts
    99

    Re: If condition for sum duplicate number

    Yes, but in proportionate with each duplicate number.

    In your mentioned formula it is calculated "1" for each row under duplicate number.

    If sum of duplicates number <=120 then formula should proportionate "1" in each duplicate rows.

    ex. 4 duplicate rows total <=120 then formula should calculate "0.25" in each rows so my total will be for that duplicate line will be "1".

    Thanks

  9. #9
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: If condition for sum duplicate number

    OK.

    Let's see if I have the concept now.

    =IF(COUNTIF($A$5:A5,A5)<=COUNTIF($A$5:$A$51,A5),IF(SUMIFS($D$5:$D$51,$A$5:$A$51,A5)>=120,1/MAX(COUNTIF($A$5:$A$51,A5)),IF(SUMIFS($D$5:$D$51,$A$5:$A$51,A5)<0,0,SUMIFS($D$5:$D$51,$A$5:$A$51,A5)/IF(OR(B5={"USA","Philippines"}),160,IF(B5="India",180)))))

  10. #10
    Registered User
    Join Date
    04-04-2014
    Location
    India,Pune
    MS-Off Ver
    Excel 2013
    Posts
    99

    Re: If condition for sum duplicate number

    Image.PNG

    I think you are almost there.

    The only issue when i drag your formula it is calculated "0.5" in column "C19" although the hours is "0" and in column "C21" it is calculate "0.475" and if do the manual total of duplicate column (C21 & C22) the total is 76 and proportionate should be "0.2375".

    Thanks for your help!!!

  11. #11
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: If condition for sum duplicate number

    I am confused.

    A19 is a duplicate of A20 and the total hours are 158. 158 > 120 resulting in 1. So shouldn't each of those be 0.5? (Posts 1, 4, 6 and 8.)

    In C21 the total is 76 but it is "Philippines" and less than 120 so shouldn't that be divided by 160? (Post 1)

  12. #12
    Registered User
    Join Date
    04-04-2014
    Location
    India,Pune
    MS-Off Ver
    Excel 2013
    Posts
    99

    Re: If condition for sum duplicate number

    Sorry for confusing.

    A19 is duplicate of A20 but the division should be proportionate of each duplicate so if you dividing 0 then it should calculate as 0 at A19 and 1 at A20.

    In C21 also it should be divided by proportionate the total is less than 120 so it should be calculate 38/160 in row C21 & 38/160 in row C22.

  13. #13
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: If condition for sum duplicate number

    OK.

    What can you tell us about C9, C10 and C11? A9, A10 and A11 are duplicates. Each of the numbers column D are < 120 but they total > 120.

  14. #14
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: If condition for sum duplicate number

    Maybe this?

    =IF(D5>=120,1,IF(D5<0,0,IF(OR(B5={"USA","Philippines"}),D5/160,IF(B5="India",D5/180,INDEX(INDEX($D$5:$D$51,MATCH(1,1/(A5=$A$5:$A$51),0)):INDEX($D$5:$D$51,MATCH(2,1/(A5=$A$5:$A$51),1))/SUM(INDEX($D$5:$D$51,MATCH(1,1/(A5=$A$5:$A$51),0)):INDEX($D$5:$D$51,MATCH(2,1/(A5=$A$5:$A$51),1))),COUNTIF($A$5:A5,A5))))))

  15. #15
    Registered User
    Join Date
    04-04-2014
    Location
    India,Pune
    MS-Off Ver
    Excel 2013
    Posts
    99

    Re: If condition for sum duplicate number

    Thank you very much..

    This formula is working...

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

    Re: If condition for sum duplicate number

    Many members are unable to see images in the *.png format due to forum compatibility issues with some browsers.

    If you need to post an image post it in the *.jpg format.

    Even better than posting images... post a SMALL sample file. That way we can test solutions directly in the file with the relevant data.

  17. #17
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: If condition for sum duplicate number

    @ rchure,

    You are welcome. Glad to hear this one works. Thank you for the feedback.

+ 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. Add a condition if there are any non-duplicate data
    By salmasaied in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 10-06-2016, 09:29 PM
  2. [SOLVED] IF the condition of gender is met AND the condition of age is met subtract this number
    By arsenalmom in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 01-16-2014, 11:16 PM
  3. Filter duplicate entries on condition
    By Mcell in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-07-2013, 05:54 AM
  4. Replies: 10
    Last Post: 10-07-2011, 03:24 AM
  5. Replies: 2
    Last Post: 09-28-2011, 09:12 AM
  6. Duplicate rows based on condition
    By booo in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-08-2010, 06:34 AM
  7. Replies: 7
    Last Post: 04-26-2010, 06:51 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