简体   繁体   中英

SUMIF formula with date criteria not working

I have a sum if statement (in german):

=SUMMEWENNS(Rawdata!K2:K3446;Rawdata!I2:I3446;"bezahlt";Rawdata!A2:A3446;">= 04.03.2013 00:00";Rawdata!A2:A3446;"<= 10.03.2013 23:59")

I'm not sure why it doesn't work, cause I have checked the cells for formatting (TT.MM.JJJJ hh:mm)

The Shees where it gets the data from Looks like this:

======= A ======      == I ==  ==== K ====
04.03.2013 22:00      bezahlt     10,20 €

The formula gives me back "0" even though it should give me back the 10,20

Where is the mistake?

EDIT the formula editor gives me back the following:

在此处输入图片说明

What do I have to edit my formula to do get the right results???

2nd EDIT

Ok the formula works now. Now I only need to be able to copy it into a field via VBA I seem to have a syntax problem:

Cells(5, fieldextsales).FormulaLocal = "=SUMMEWENNS(Rawdata!K2:K" & maxnumrows & ";Rawdata!I2:I" & maxnumrows & ";""bezahlt"";Rawdata!A2:A" & maxnumrows & ";"">= "&DATWERT(""& weekstart &" 23:59")";Rawdata!A2:A" & maxnumrows & ";""<= "&DATWERT(""& weekend & " 23:59"))"

Thx for the help

如果您的单元格日期金额存储为格式化的日期金额,则将公式更改为:

=SUMMEWENNS(Rawdata!K2:K3446;Rawdata!I2:I3446;"bezahlt";Rawdata!A2:A3446;">="&DATWERT("04.03.2013 00:00");Rawdata!A2:A3446;"<="&DATWERT("10.03.2013 23:59"))

As an alternative to @chuff's answer that doesn't rely on DATEVALUE to interpret the date format, you might try...

=SUMMEWENNS(Rawdata!K2:K3446;Rawdata!I2:I3446;"bezahlt";Rawdata!A2:A3446;">="&DATUM(2013;3;4);Rawdata!A2:A3446;"<"&DATUM(2013;3;11))

...where DATUM is the German name for the worksheet function named DATE in English.

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