简体   繁体   中英

How to Use General Operators in Excel

I do not know how to ask it right

I use a formula to summarize values within a certain range

And I have two questions

F1 contains the value I want to summarize, if I write "*", it summarizes everything, but without empty cells

"E" contains the first-last date to summarize, what the parameter to summarize all dates? (* Does not work)

That's my formula

=SUMIFS(B1:B8,A1:A8,">="&E1,A1:A8,"<="&E2,c1:c8,F1)

explanation: "A" contains the dates, "B" contains the amounts, "C" contains the values, "E" contains the first-last date in summary

Sometimes I want to summarize everything regardless of the date, value of the cell

I have other parameters that are not related here

If it is not clear, respond to me

在此处输入图片说明

In this case you should use SUMPRODUCT , so you can just eliminate any of your criteria using IF 's inside.

For example:

=SUMPRODUCT(B2:B8*(IF(ISNUMBER(E2)=TRUE,A2:A8>=E2,1))*(IF(ISNUMBER(E3)=TRUE,A2:A8<=E3,1))*(C2:C8=D1))

You can make the IF 's you want. I've used ISNUMBER but you can just make a list validation and insert a "All Dates" and pass this to the IF test. Remember to close with ctrl+shift+enter.

EDIT: as now I have some of your data and now can understand better you request, I have adapted the formula to work as you need. Wrapped both IF 's in one, which will check if F1 has "*" in it's value.

=SUMPRODUCT((B2:B8)*(IF(F1="*",1,(A2:A8>=E1)*(A2:A8<=E2)*(C2:C8=F1))))

EDIT: forgot parentheses inside the if

newer EDIT: adapted the formula to what I think OverflowStack is trying to tell me (sorry people, my english understanding is not that good...), now if F1 is a value contained in the C column, it will return that sum summarized between dates, if the value is "*" it will return the total count.

If it's still not what OP needs, I could probably do better if I can access a dummy sheet of his data on Excel Online, with his variables and desired output example.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM