# Sum of selective cells by logic in a row

1. ## 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 ?

SUM of cells next to Code 10=100+200+400 =700
SUM of cells next to Code 20=250+50 =300  Register To Reply

2. ## 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.  Register To Reply

3. ## 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.  Register To Reply

4. ## 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  Register To Reply

5. ## Re: Sum of selective cells by logic in a row  Register To Reply

6. ## Re: Sum of selective cells by logic in a row

See sheet. My formula did what you wanted.  Register To Reply

7. ## Re: Sum of selective cells by logic in a row

Thank you Glenn..it worked perfectly.  Register To Reply

8. ## Re: Sum of selective cells by logic in a row

You're welcome.

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.  Register To Reply

9. ## Re: Sum of selective cells by logic in a row

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

10. ## 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.

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.  Register To Reply

11. ## Re: Sum of selective cells by logic in a row

=SUMIFS(C2:Q2,D2:R2,"ABC")  Register To Reply

12. ## Re: Sum of selective cells by logic in a row

Thank you, worked like a charm.  Register To Reply

13. ## 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)  Register To Reply

14. ## Re: Sum of selective cells by logic in a row

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

15. ## Re: Sum of selective cells by logic in a row

title : Sum of cells by logic in a row  Register To Reply

16. ## Re: Sum of selective cells by logic in a row

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.  Register To Reply

There are currently 1 users browsing this thread. (0 members and 1 guests) 