+ 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... based in Ireland
    MS-Off Ver
    µSoft Office 365. Learning Excel all over again!!
    Posts
    30,754

    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



  3. #3
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    2012 for Mac at home
    Posts
    7,304

    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
    21,548

    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... based in Ireland
    MS-Off Ver
    µSoft Office 365. Learning Excel all over again!!
    Posts
    30,754

    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... based in Ireland
    MS-Off Ver
    µSoft Office 365. Learning Excel all over again!!
    Posts
    30,754

    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... based in Ireland
    MS-Off Ver
    µSoft Office 365. Learning Excel all over again!!
    Posts
    30,754

    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
    Ipswich, England
    MS-Off Ver
    MS 365 Subscription Insider (Windows 10)
    Posts
    50,935

    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!

    Forum Rules (updated September 2018): please read them here.
    How to use the Power Query code you've been given: help here. More about the Power suite here.
    Don't forget to say "thank you" to those who have helped you in your thread. If you wish, you can also reward them by clicking on their reputation star bottom left.

  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
    Ipswich, England
    MS-Off Ver
    MS 365 Subscription Insider (Windows 10)
    Posts
    50,935

    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
    Ipswich, England
    MS-Off Ver
    MS 365 Subscription Insider (Windows 10)
    Posts
    50,935

    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