DATE N ABC
2010-05-03 2 b
2010-09-16 4 c
2011-05-02 2 b
2011-09-15 4 c
2011-09-19 3.6 a
2012-05-02 3 b
2012-07-17 10 c
2012-09-12 3.6 a
2012-09-13 4 a
2013-04-29 3 b
2013-07-01 10 c
2013-09-17 4 c
2013-09-19 4 a
2014-09-17 4 c
2015-09-17 4 c
j’essaie d'écrire la formule suivante sur vba
=SOMMEPROD(--(A2:A16>AUJOURDHUI())*(A2:A16<DATE(2012;12;31))*(C2:C16="a")*(B2:B16))
qui retourne 7.6
Sub Macro1()
Dim DateRange As Range, NRange As Range, ABCRange As Range, start_date As Date, end_date As Date, ABC As String, n
Set DateRange = Range("A2:A16")
Set NRange = Range("B2:B16")
Set ABCRange = Range("C2:C16")
start_date = DateSerial(2012, 8, 23)
end_date = DateSerial(2012, 12, 31)
ABC = "a"
n = Evaluate("SumProduct((" & DateRange.Address & " > " & start_date & ") * (" & _
DateRange.Address & " < " & end_date & ") * (" & ABCRange.Address & " = " & ABC & ") * (" & NRange.Address & "))")
End Sub
mais n retourne une valeur d'erreur
alors un grand merci à tous ceux qui se pencheront sur ce problème.
--
isabelle
DATE N ABC 2010-05-03 2 b 2010-09-16 4 c 2011-05-02 2 b 2011-09-15 4 c 2011-09-19 3.6 a 2012-05-02 3 b 2012-07-17 10 c 2012-09-12 3.6 a 2012-09-13 4 a 2013-04-29 3 b 2013-07-01 10 c 2013-09-17 4 c 2013-09-19 4 a 2014-09-17 4 c 2015-09-17 4 c
j’essaie d'écrire la formule suivante sur vba
=SOMMEPROD(--(A2:A16>AUJOURDHUI())*(A2:A16<DATE(2012;12;31))*(C2:C16="a")*(B2:B16)) qui retourne 7.6
Sub Macro1() Dim DateRange As Range, NRange As Range, ABCRange As Range, start_date As Date, end_date As Date, ABC As String, n Set DateRange = Range("A2:A16") Set NRange = Range("B2:B16") Set ABCRange = Range("C2:C16") start_date = DateSerial(2012, 8, 23) end_date = DateSerial(2012, 12, 31) ABC = "a" n = Evaluate("SumProduct((" & DateRange.Address & " > " & start_date & ") * (" & _ DateRange.Address & " < " & end_date & ") * (" & ABCRange.Address & " = " & ABC & ") * (" & NRange.Address & "))") End Sub
mais n retourne une valeur d'erreur
alors un grand merci à tous ceux qui se pencheront sur ce problème.
DATE N ABC
2010-05-03 2 b
2010-09-16 4 c
2011-05-02 2 b
2011-09-15 4 c
2011-09-19 3.6 a
2012-05-02 3 b
2012-07-17 10 c
2012-09-12 3.6 a
2012-09-13 4 a
2013-04-29 3 b
2013-07-01 10 c
2013-09-17 4 c
2013-09-19 4 a
2014-09-17 4 c
2015-09-17 4 c
j’essaie d'écrire la formule suivante sur vba
=SOMMEPROD(--(A2:A16>AUJOURDHUI())*(A2:A16<DATE(2012;12;31))*(C2:C16="a")*(B2:B16))
qui retourne 7.6
Sub Macro1()
Dim DateRange As Range, NRange As Range, ABCRange As Range, start_date As
Date, end_date As Date, ABC As String, n
Set DateRange = Range("A2:A16")
Set NRange = Range("B2:B16")
Set ABCRange = Range("C2:C16")
start_date = DateSerial(2012, 8, 23)
end_date = DateSerial(2012, 12, 31)
ABC = "a"
n = Evaluate("SumProduct((" & DateRange.Address & " > " & start_date & ") *
(" & _
DateRange.Address & " < " & end_date & ") * (" & ABCRange.Address & " = " &
ABC & ") * (" & NRange.Address & "))")
End Sub
mais n retourne une valeur d'erreur
alors un grand merci à tous ceux qui se pencheront sur ce problème.
DATE N ABC 2010-05-03 2 b 2010-09-16 4 c 2011-05-02 2 b 2011-09-15 4 c 2011-09-19 3.6 a 2012-05-02 3 b 2012-07-17 10 c 2012-09-12 3.6 a 2012-09-13 4 a 2013-04-29 3 b 2013-07-01 10 c 2013-09-17 4 c 2013-09-19 4 a 2014-09-17 4 c 2015-09-17 4 c
j’essaie d'écrire la formule suivante sur vba
=SOMMEPROD(--(A2:A16>AUJOURDHUI())*(A2:A16<DATE(2012;12;31))*(C2:C16="a")*(B2:B16)) qui retourne 7.6
Sub Macro1() Dim DateRange As Range, NRange As Range, ABCRange As Range, start_date As Date, end_date As Date, ABC As String, n Set DateRange = Range("A2:A16") Set NRange = Range("B2:B16") Set ABCRange = Range("C2:C16") start_date = DateSerial(2012, 8, 23) end_date = DateSerial(2012, 12, 31) ABC = "a" n = Evaluate("SumProduct((" & DateRange.Address & " > " & start_date & ") * (" & _ DateRange.Address & " < " & end_date & ") * (" & ABCRange.Address & " = " & ABC & ") * (" & NRange.Address & "))") End Sub
mais n retourne une valeur d'erreur
alors un grand merci à tous ceux qui se pencheront sur ce problème.
Yopop
Bonjour Isabelle,
j'ai modifié 2 choses dans ta macro ci-dessous:
les triples guillemets pour ABC ABC = """a"""
et j'ai incorporé le date(yy,mm,dd) dans le sommeprod pour le début et la fin.
Sub Macro1() Dim DateRange As Range, NRange As Range, ABCRange As Range, start_date As Date, end_date As Date, ABC As String, n Set DateRange = Range("A2:A16") Set NRange = Range("B2:B16") Set ABCRange = Range("C2:C16")
DATE N ABC 2010-05-03 2 b 2010-09-16 4 c 2011-05-02 2 b 2011-09-15 4 c 2011-09-19 3.6 a 2012-05-02 3 b 2012-07-17 10 c 2012-09-12 3.6 a 2012-09-13 4 a 2013-04-29 3 b 2013-07-01 10 c 2013-09-17 4 c 2013-09-19 4 a 2014-09-17 4 c 2015-09-17 4 c
Sub Macro1() Dim DateRange As Range, NRange As Range, ABCRange As Range, start_date As Date, end_date As Date, ABC As String, n Set DateRange = Range("A2:A16") Set NRange = Range("B2:B16") Set ABCRange = Range("C2:C16") start_date = DateSerial(2012, 8, 23) end_date = DateSerial(2012, 12, 31) ABC = "a" n = Evaluate("SumProduct((" & DateRange.Address & " > " & start_date & ") * (" & _ DateRange.Address & " < " & end_date & ") * (" & ABCRange.Address & " > " & ABC & ") * (" & NRange.Address & "))") End Sub
mais n retourne une valeur d'erreur
alors un grand merci à tous ceux qui se pencheront sur ce problème.
Bonjour Isabelle,
j'ai modifié 2 choses dans ta macro ci-dessous:
les triples guillemets pour ABC
ABC = """a"""
et j'ai incorporé le date(yy,mm,dd) dans le sommeprod pour le début et
la fin.
Sub Macro1()
Dim DateRange As Range, NRange As Range, ABCRange As Range, start_date
As Date, end_date As Date, ABC As String, n
Set DateRange = Range("A2:A16")
Set NRange = Range("B2:B16")
Set ABCRange = Range("C2:C16")
DATE N ABC
2010-05-03 2 b
2010-09-16 4 c
2011-05-02 2 b
2011-09-15 4 c
2011-09-19 3.6 a
2012-05-02 3 b
2012-07-17 10 c
2012-09-12 3.6 a
2012-09-13 4 a
2013-04-29 3 b
2013-07-01 10 c
2013-09-17 4 c
2013-09-19 4 a
2014-09-17 4 c
2015-09-17 4 c
et j'ai incorporé le date(yy,mm,dd) dans le sommeprod pour le début et la fin.
Sub Macro1() Dim DateRange As Range, NRange As Range, ABCRange As Range, start_date As Date, end_date As Date, ABC As String, n Set DateRange = Range("A2:A16") Set NRange = Range("B2:B16") Set ABCRange = Range("C2:C16")
DATE N ABC 2010-05-03 2 b 2010-09-16 4 c 2011-05-02 2 b 2011-09-15 4 c 2011-09-19 3.6 a 2012-05-02 3 b 2012-07-17 10 c 2012-09-12 3.6 a 2012-09-13 4 a 2013-04-29 3 b 2013-07-01 10 c 2013-09-17 4 c 2013-09-19 4 a 2014-09-17 4 c 2015-09-17 4 c
Sub Macro1() Dim DateRange As Range, NRange As Range, ABCRange As Range, start_date As Date, end_date As Date, ABC As String, n Set DateRange = Range("A2:A16") Set NRange = Range("B2:B16") Set ABCRange = Range("C2:C16") start_date = DateSerial(2012, 8, 23) end_date = DateSerial(2012, 12, 31) ABC = "a" n = Evaluate("SumProduct((" & DateRange.Address & " > " & start_date & ") * (" & _ DateRange.Address & " < " & end_date & ") * (" & ABCRange.Address & " > " & ABC & ") * (" & NRange.Address & "))") End Sub
mais n retourne une valeur d'erreur
alors un grand merci à tous ceux qui se pencheront sur ce problème.
isabelle
merci à vous deux, l'erreur provenait bien des guillemets de texte
j'ai également modifié la déclaration des variables start_date et end_date As Long
-- isabelle
Le 2012-08-23 20:36, isabelle a écrit :
salutatous,
pouvez-vous m'aider à trouver l'erreur..
DATE N ABC 2010-05-03 2 b 2010-09-16 4 c 2011-05-02 2 b 2011-09-15 4 c 2011-09-19 3.6 a 2012-05-02 3 b 2012-07-17 10 c 2012-09-12 3.6 a 2012-09-13 4 a 2013-04-29 3 b 2013-07-01 10 c 2013-09-17 4 c 2013-09-19 4 a 2014-09-17 4 c 2015-09-17 4 c
j’essaie d'écrire la formule suivante sur vba
=SOMMEPROD(--(A2:A16>AUJOURDHUI())*(A2:A16<DATE(2012;12;31))*(C2:C16="a")*(B2:B16)) qui retourne 7.6
Sub Macro1() Dim DateRange As Range, NRange As Range, ABCRange As Range, start_date As Date, end_date As Date, ABC As String, n Set DateRange = Range("A2:A16") Set NRange = Range("B2:B16") Set ABCRange = Range("C2:C16") start_date = DateSerial(2012, 8, 23) end_date = DateSerial(2012, 12, 31) ABC = "a" n = Evaluate("SumProduct((" & DateRange.Address & " > " & start_date & ") * (" & _ DateRange.Address & " < " & end_date & ") * (" & ABCRange.Address & " = " & ABC & ") * (" & NRange.Address & "))") End Sub
mais n retourne une valeur d'erreur
alors un grand merci à tous ceux qui se pencheront sur ce problème.
merci à vous deux, l'erreur provenait bien des guillemets de texte
j'ai également modifié la déclaration des variables start_date et end_date As Long
--
isabelle
Le 2012-08-23 20:36, isabelle a écrit :
salutatous,
pouvez-vous m'aider à trouver l'erreur..
DATE N ABC
2010-05-03 2 b
2010-09-16 4 c
2011-05-02 2 b
2011-09-15 4 c
2011-09-19 3.6 a
2012-05-02 3 b
2012-07-17 10 c
2012-09-12 3.6 a
2012-09-13 4 a
2013-04-29 3 b
2013-07-01 10 c
2013-09-17 4 c
2013-09-19 4 a
2014-09-17 4 c
2015-09-17 4 c
j’essaie d'écrire la formule suivante sur vba
=SOMMEPROD(--(A2:A16>AUJOURDHUI())*(A2:A16<DATE(2012;12;31))*(C2:C16="a")*(B2:B16))
qui retourne 7.6
Sub Macro1()
Dim DateRange As Range, NRange As Range, ABCRange As Range, start_date As Date, end_date As Date, ABC As String, n
Set DateRange = Range("A2:A16")
Set NRange = Range("B2:B16")
Set ABCRange = Range("C2:C16")
start_date = DateSerial(2012, 8, 23)
end_date = DateSerial(2012, 12, 31)
ABC = "a"
n = Evaluate("SumProduct((" & DateRange.Address & " > " & start_date & ") * (" & _
DateRange.Address & " < " & end_date & ") * (" & ABCRange.Address & " = " & ABC & ") * (" & NRange.Address & "))")
End Sub
mais n retourne une valeur d'erreur
alors un grand merci à tous ceux qui se pencheront sur ce problème.
merci à vous deux, l'erreur provenait bien des guillemets de texte
j'ai également modifié la déclaration des variables start_date et end_date As Long
-- isabelle
Le 2012-08-23 20:36, isabelle a écrit :
salutatous,
pouvez-vous m'aider à trouver l'erreur..
DATE N ABC 2010-05-03 2 b 2010-09-16 4 c 2011-05-02 2 b 2011-09-15 4 c 2011-09-19 3.6 a 2012-05-02 3 b 2012-07-17 10 c 2012-09-12 3.6 a 2012-09-13 4 a 2013-04-29 3 b 2013-07-01 10 c 2013-09-17 4 c 2013-09-19 4 a 2014-09-17 4 c 2015-09-17 4 c
j’essaie d'écrire la formule suivante sur vba
=SOMMEPROD(--(A2:A16>AUJOURDHUI())*(A2:A16<DATE(2012;12;31))*(C2:C16="a")*(B2:B16)) qui retourne 7.6
Sub Macro1() Dim DateRange As Range, NRange As Range, ABCRange As Range, start_date As Date, end_date As Date, ABC As String, n Set DateRange = Range("A2:A16") Set NRange = Range("B2:B16") Set ABCRange = Range("C2:C16") start_date = DateSerial(2012, 8, 23) end_date = DateSerial(2012, 12, 31) ABC = "a" n = Evaluate("SumProduct((" & DateRange.Address & " > " & start_date & ") * (" & _ DateRange.Address & " < " & end_date & ") * (" & ABCRange.Address & " = " & ABC & ") * (" & NRange.Address & "))") End Sub
mais n retourne une valeur d'erreur
alors un grand merci à tous ceux qui se pencheront sur ce problème.