+ Reply to Thread
Results 1 to 16 of 16

Sum of selective cells by logic in a row

  1. #1
    Registered User
    Join Date
    12-11-2020
    Location
    USA
    MS-Off Ver
    Professional
    Posts
    18

    Question Sum of selective cells by logic in a row

    Here is my question:

    How to add selective items in a cell?


    Tried using SUMIF, OFFSET functions with no luck. (SUMIF(range,COUNTIF(range, "10"), OFFSET(range,1,0))

    Please advise what functions can be used to solve this problem ?

    Thank you for your time.


    SUM of cells next to Code 10=100+200+400 =700
    SUM of cells next to Code 20=250+50 =300
    Attached Files Attached Files
    Last edited by chintakk; 12-23-2020 at 06:38 PM.

  2. #2
    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
    43,986

    Re: Sum of selective cells by logic in a row

    Next time, please read the yellow banner (top of page) and attach a sample Excel sheet.

    =SUMPRODUCT(--($A$8:$K$8=10),$B$8:$L$8)

    Note the ranges OVERLAP.
    Attached Files Attached Files
    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.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  3. #3
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,496

    Re: Sum of selective cells by logic in a row

    How is the formula supposed to know which items in the cell to add?

    Why for example isn’t it going to add the 10 and the 20 and the four and six?

    A workbook with a very representative sample and expect results would be very helpful, refer to the yellow banner at the top of the post for the instructions on how to upload one.
    Make contributors happy, click on the "* Add Reputation" as a way to say thank you.
    Sam Capricci

  4. #4
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,704

    Re: Sum of selective cells by logic in a row

    So, you have 10;3 in a cell in column A (let's say in A2), then 20;4 in B2, 10;5 in C2, and 20;6 in D2? Is that what you mean, where the number to the left of the semicolon is the category and the number to the right is the quantity?

    It would help if you attached a sample Excel workbook, as detailed in the yellow banner at the top of the screen.

    Hope this helps.

    Pete

  5. #5
    Registered User
    Join Date
    12-11-2020
    Location
    USA
    MS-Off Ver
    Professional
    Posts
    18

    Re: Sum of selective cells by logic in a row

    Thank you for the responses. Made changes in the question, added a spreadsheet showing example.

  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
    43,986

    Re: Sum of selective cells by logic in a row

    See sheet. My formula did what you wanted.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    12-11-2020
    Location
    USA
    MS-Off Ver
    Professional
    Posts
    18

    Re: Sum of selective cells by logic in a row

    Thank you Glenn..it worked perfectly.

  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
    43,986

    Re: Sum of selective cells by logic in a row

    You're welcome.



    If that takes care of your original question, please select "Thread Tools" from the menu link above and mark this thread as SOLVED.

    It'd also be appreciated if you were to click the Add Reputation button at the foot of any of the posts of all members who helped you reach a solution.

  9. #9
    Registered User
    Join Date
    12-11-2020
    Location
    USA
    MS-Off Ver
    Professional
    Posts
    18

    Re: Sum of selective cells by logic in a row

    Another question in similar format, Total sum of cells before the matching text (ABC).

    Thank you in advance.
    Attached Files Attached Files

  10. #10
    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
    43,986

    Re: Sum of selective cells by logic in a row

    Same sort of formula... with a different arrangement of overlapping range.

    =SUMPRODUCT(--(D2:P2="ABC"),C2:O2)

    You're welcome.



    If that takes care of your original question, please select "Thread Tools" from the menu link above and mark this thread as SOLVED.

    It'd also be appreciated if you were to click the Add Reputation button at the foot of any of the posts of all members who helped you reach a solution.
    Attached Files Attached Files

  11. #11
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,460

    Re: Sum of selective cells by logic in a row

    Start a new thread for new questions in future, please.

    =SUMIFS(C2:Q2,D2:R2,"ABC")
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  12. #12
    Registered User
    Join Date
    12-11-2020
    Location
    USA
    MS-Off Ver
    Professional
    Posts
    18

    Re: Sum of selective cells by logic in a row

    Thank you, worked like a charm.

  13. #13
    Registered User
    Join Date
    12-11-2020
    Location
    USA
    MS-Off Ver
    Professional
    Posts
    18

    Re: Sum of selective cells by logic in a row

    Another similar question:
    SUM of cells before the code ABC & has BAT in the cell before (details in the spreadsheet)
    Attached Files Attached Files

  14. #14
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,460

    Re: Sum of selective cells by logic in a row

    No - this time start a new thread with an appropriate title.

  15. #15
    Registered User
    Join Date
    12-11-2020
    Location
    USA
    MS-Off Ver
    Professional
    Posts
    18

    Re: Sum of selective cells by logic in a row

    Created a new thread
    title : Sum of cells by logic in a row

  16. #16
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,460

    Re: Sum of selective cells by logic in a row

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

    Also, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

+ 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. Transfer selective cells value in a flagged row to new sheet Respectively
    By Sebastine8287 in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 03-26-2020, 04:34 AM
  2. [SOLVED] Problem with copying formula with selective cells
    By brandedadnan in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 04-21-2013, 03:01 PM
  3. Locking Selective Cells for Input
    By mp4-4 in forum Excel General
    Replies: 2
    Last Post: 03-24-2013, 09:08 AM
  4. Format mouse, to sum selective cells
    By Lou06488 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-07-2013, 09:14 PM
  5. Range Query - Selective cells
    By superdonk in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-16-2013, 01:21 PM
  6. Adding a column, but with selective cells only
    By Austin Healey in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-31-2009, 09:50 PM
  7. Format change selective cells
    By tmreynolds in forum Excel General
    Replies: 1
    Last Post: 03-07-2009, 08:50 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