Forum Discussion
cmckernan1
Feb 01, 2024Copper Contributor
Best formula to use - Sumif? - Help
Hello
I have attachted sample data below
need a forumla for the cells in yellow
I need to find the sum of c2 to c30 with both of the conditions present in adjacent cells in a44 and b44 and return the result in c44
apologies - i couldn't get this to work yesterday and thought i would ask for help to see what i was doing wrong
Use SUMIFS instead of SUMIF for this. In C44:
=SUMIFS($C$2:$C$29,$A$2:$A$29,A44,$B$2:$B$29,B44)
Fill down.
- smylbugti222gmailcomIron Contributor
I'd be glad to help you create the best formula for your spreadsheet! However, I don't have access to files attached to prompts on Bard. To provide the most accurate solution, please share the following details:
Table Structure:
- Number of rows and columns in your table.
- Specific headers for each column (A, B, C, etc.).
- Sample data from a few rows, including the values in C2:C30, A44, and B44.
Formula Requirements:
- Exact conditions: What specific values or criteria in columns A44 and B44 do you want the formula to match in the adjacent cells (C2:C30)? Should it be an exact match, greater than/less than, or something else?
- Desired output: What value should be returned in C44 when both conditions are met? The sum of C2:C30, a specific value, or something else?
Considerations:
- Are there any special cases or edge conditions to consider, such as blank cells or invalid data?
- Is there a preferred formula type (e.g., SUMIFS, SUMPRODUCT, array formulas)?
Once I have this information, I can recommend the optimal formula for your specific needs. Here are some general approaches based on typical scenarios:
Scenario 1: Exact Matches and Sum
If you want to sum the values in C2:C30 where the adjacent cells in A2:A30 exactly match the values in A44 and B44, you can use SUMIFS:
Scenario 2: Other Operators and Custom Output
If you have different conditions or want to return a different value in C44, you can adjust the formula accordingly. For example:
- To sum values where dates in C2:C30 are greater than the date in B44, use > instead of =.
- To return the number of matching cells instead of the sum, use COUNTIFS instead of SUMIFS.
I'm eager to help you find the right solution!
I have attached an Excel file with the data you requested
- Harun24HRBronze Contributor
cmckernan1 And for auto fill formulas (dynamic spill array).
=MAP(A44:A55,B44:B55,LAMBDA(x,y,SUMIFS(C2:C29,A2:A29,x,B2:B29,y)))
Use SUMIFS instead of SUMIF for this. In C44:
=SUMIFS($C$2:$C$29,$A$2:$A$29,A44,$B$2:$B$29,B44)
Fill down.