# How can I add alternate cells in a row if the adjacent column meets a certain criteria.

1. ## How can I add alternate cells in a row if the adjacent column meets a certain criteria.

Let me explain this with an example - If column A, C, E, G are for denoting expenses [just numbers] and column B, D, F, H denote different methods used in expenses like cash, card, paytm etc selected via dropdown data validation; then I want to add the cells A, C, E and G and get a total cash expenditure of the day in column I. Can anybody help me solve this query? Thanks in advance for your time and effort.

I have edited this post and uploaded an excel file. In the attached file how can I calculate the total cash expenditure on 01/12/2020. As you can see that some of the payments on that day have been made through card the others through cash. So i want that In K3 I can get a total of all the cells which are cash payments. Then I will replicate this formula for the rest of the cells in that column by dragging the formula. Sorry for not being able to explain myself in the first time.

2. ## Re: How can I add alternate cells in a row if the adjacent column meets a certain criteria

=SUMPRODUCT(--(\$A\$3:\$G\$10="Cash"),\$B\$3:\$H\$10)

see file. Next time,please remember that a picture is worth 1,000 words. An Excel sheet is worth 1,000 pictures.

So, read the yellow banner about sample worksheets, at the top of the screen. Act on its guidelines and post a SMALL sample sheet.

3. ## Re: How can I add alternate cells in a row if the adjacent column meets a certain criteria

@Glenn: if I’ve read the question right, the numbers and descriptions are the other way round.

4. ## Re: How can I add alternate cells in a row if the adjacent column meets a certain criteria

Aha! So far no coffee this morning. Only tea and Corn Flakes.

If that's the case:
=SUMPRODUCT(--(\$B\$3:\$H\$10="Cash"),\$A\$3:\$G\$10)

5. ## Re: How can I add alternate cells in a row if the adjacent column meets a certain criteria

Thank you for replying. But I guess I wasn't able to explain my query well. Although your answer seems to be a solution of a more complex query that I may need in future and will save it.

Sorry to bother you again, but I have edited my original post and uploaded a small portion of the excel sheet to explain my query. Can you please find a file named Textbook attached to the original query and look into it when you have time to spare. Thanks a lot!

6. ## Re: How can I add alternate cells in a row if the adjacent column meets a certain criteria

Is this what you want??

=SUMPRODUCT(--(D3:J3="Cash"),C3:I3)

copied down. If not, add manually calculated results to your file.

7. ## Re: How can I add alternate cells in a row if the adjacent column meets a certain criteria

Originally Posted by mastexcelforum
Let me explain this with an example - If column A, C, E, G are for denoting expenses [just numbers] and column B, D, F, H denote different methods used in expenses like cash, card, paytm etc
Column A is date.

8. ## Re: How can I add alternate cells in a row if the adjacent column meets a certain criteria

Bang On! I have spent not less than 10 hours to figure this out in vain. And I am sure you must have done this in not more than 10 secs. I was able to apply it to the complete column by dragging the formula. Thank you so much Glenn, you really saved my day!!

##### Users Browsing this Thread

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

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