Need Help with Formula Expansion

K

Kaylen

Good morning,
I have a formula which I need help on expanding to calculate for the
quarter. Currently this is my formula in a query I have:

Number of Files Reviewed: DCount("*","Files","[Review Date] and [Review
Date]=#" & [Confirm Review Date] & "#")

The user has to enter twice a single Review Date (twice because there are
two connected tables) to get the result of the count. Now I would like to
expand the formula to allow a count for the quarter, which means I would like
to be able to get a count of files for 3 selected review dates instead of
just 1. I would like the user to select or enter in three different review
dates so the formula can calculate the number of files reviewed for those
three dates using the formula above. Any help or suggesstion would be a very
much appreciated!
 
M

MGFoster

Kaylen said:
Good morning,
I have a formula which I need help on expanding to calculate for the
quarter. Currently this is my formula in a query I have:

Number of Files Reviewed: DCount("*","Files","[Review Date] and [Review
Date]=#" & [Confirm Review Date] & "#")

The user has to enter twice a single Review Date (twice because there are
two connected tables) to get the result of the count. Now I would like to
expand the formula to allow a count for the quarter, which means I would like
to be able to get a count of files for 3 selected review dates instead of
just 1. I would like the user to select or enter in three different review
dates so the formula can calculate the number of files reviewed for those
three dates using the formula above. Any help or suggesstion would be a very
much appreciated!


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

You only need one date to calc for the qtr. Something like this:

Number of Files Reviewed: DCount("*","Files","[Review Date] Between " &
[Start of Quarter Date] & " And " & DateAdd("q", 1, [Start of Quarter
Date])-1)

Set up the Parameters for [Start of Quarter Date] as a DateTime data
type 'cuz you won't have to use the # delimiter in the expression.

The user has to enter the exact 1st date of the beginning of the
quarter. E.g.: 1/1/09 or 4/1/09 or 7/1/09, etc.
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
** Respond only to this newsgroup. I DO NOT respond to emails **

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBSbXtZIechKqOuFEgEQIXUQCg4/Ysd9++u9iJIxBIufLMmjKTDsIAoO5T
0mcf8mnQZDUaEUTwopKOR4Sw
=X1Wn
-----END PGP SIGNATURE-----
 
K

Kaylen

Thank you MG Foster for your input. I tried the formula and kept getting
zero. I have 18 files for the quarter but the formula resulted in 18 zeros
instead of just one number 18. My goal is to have the result for the quarter
in just one number, not for each single files. Can you help?

MGFoster said:
Kaylen said:
Good morning,
I have a formula which I need help on expanding to calculate for the
quarter. Currently this is my formula in a query I have:

Number of Files Reviewed: DCount("*","Files","[Review Date] and [Review
Date]=#" & [Confirm Review Date] & "#")

The user has to enter twice a single Review Date (twice because there are
two connected tables) to get the result of the count. Now I would like to
expand the formula to allow a count for the quarter, which means I would like
to be able to get a count of files for 3 selected review dates instead of
just 1. I would like the user to select or enter in three different review
dates so the formula can calculate the number of files reviewed for those
three dates using the formula above. Any help or suggesstion would be a very
much appreciated!


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

You only need one date to calc for the qtr. Something like this:

Number of Files Reviewed: DCount("*","Files","[Review Date] Between " &
[Start of Quarter Date] & " And " & DateAdd("q", 1, [Start of Quarter
Date])-1)

Set up the Parameters for [Start of Quarter Date] as a DateTime data
type 'cuz you won't have to use the # delimiter in the expression.

The user has to enter the exact 1st date of the beginning of the
quarter. E.g.: 1/1/09 or 4/1/09 or 7/1/09, etc.
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
** Respond only to this newsgroup. I DO NOT respond to emails **

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBSbXtZIechKqOuFEgEQIXUQCg4/Ysd9++u9iJIxBIufLMmjKTDsIAoO5T
0mcf8mnQZDUaEUTwopKOR4Sw
=X1Wn
-----END PGP SIGNATURE-----
 
M

MGFoster

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Apparently, the # delimiters are needed in the DCount() function;
therefore, change to this:

Number of Files Reviewed: DCount("*","Files","[Review Date] >= #" &
[Start of Quarter Date] & "# And [Review Date] < #" & DateAdd("q", 1,
[Start of Quarter Date]) & "#")

Be sure to enter the first date of the quarter as the [Start of Quarter
Date].

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
** Respond only to this newsgroup. I DO NOT respond to emails **

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBSbdGw4echKqOuFEgEQL1CwCfT3a9uDCBHONSG4xcDaqTlKA3MwYAoLTn
PNaBh5libSmyhN5yVU5YST3Q
=Ib15
-----END PGP SIGNATURE-----


Thank you MG Foster for your input. I tried the formula and kept getting
zero. I have 18 files for the quarter but the formula resulted in 18 zeros
instead of just one number 18. My goal is to have the result for the quarter
in just one number, not for each single files. Can you help?

MGFoster said:
Kaylen said:
Good morning,
I have a formula which I need help on expanding to calculate for the
quarter. Currently this is my formula in a query I have:

Number of Files Reviewed: DCount("*","Files","[Review Date] and [Review
Date]=#" & [Confirm Review Date] & "#")

The user has to enter twice a single Review Date (twice because there are
two connected tables) to get the result of the count. Now I would like to
expand the formula to allow a count for the quarter, which means I would like
to be able to get a count of files for 3 selected review dates instead of
just 1. I would like the user to select or enter in three different review
dates so the formula can calculate the number of files reviewed for those
three dates using the formula above. Any help or suggesstion would be a very
much appreciated!

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

You only need one date to calc for the qtr. Something like this:

Number of Files Reviewed: DCount("*","Files","[Review Date] Between " &
[Start of Quarter Date] & " And " & DateAdd("q", 1, [Start of Quarter
Date])-1)

Set up the Parameters for [Start of Quarter Date] as a DateTime data
type 'cuz you won't have to use the # delimiter in the expression.

The user has to enter the exact 1st date of the beginning of the
quarter. E.g.: 1/1/09 or 4/1/09 or 7/1/09, etc.
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
** Respond only to this newsgroup. I DO NOT respond to emails **

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBSbXtZIechKqOuFEgEQIXUQCg4/Ysd9++u9iJIxBIufLMmjKTDsIAoO5T
0mcf8mnQZDUaEUTwopKOR4Sw
=X1Wn
-----END PGP SIGNATURE-----
 
K

Kaylen

I tried the formula but it gives me the count of all the files. I have sample
files from 1/1/09 through 5/1/09, and I expect the formula to count only
files from Jan to March, but it counts everything from the beginning date
until the last date I have. Can you help correct this formula so that it
counts only the begin quarter date to the 3rd month after? Or if there is a
formula where I can specify the begin date and the end date, that would be
fine too. Thank so much for your help!

MGFoster said:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Apparently, the # delimiters are needed in the DCount() function;
therefore, change to this:

Number of Files Reviewed: DCount("*","Files","[Review Date] >= #" &
[Start of Quarter Date] & "# And [Review Date] < #" & DateAdd("q", 1,
[Start of Quarter Date]) & "#")

Be sure to enter the first date of the quarter as the [Start of Quarter
Date].

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
** Respond only to this newsgroup. I DO NOT respond to emails **

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBSbdGw4echKqOuFEgEQL1CwCfT3a9uDCBHONSG4xcDaqTlKA3MwYAoLTn
PNaBh5libSmyhN5yVU5YST3Q
=Ib15
-----END PGP SIGNATURE-----


Thank you MG Foster for your input. I tried the formula and kept getting
zero. I have 18 files for the quarter but the formula resulted in 18 zeros
instead of just one number 18. My goal is to have the result for the quarter
in just one number, not for each single files. Can you help?

MGFoster said:
Kaylen wrote:
Good morning,
I have a formula which I need help on expanding to calculate for the
quarter. Currently this is my formula in a query I have:

Number of Files Reviewed: DCount("*","Files","[Review Date] and [Review
Date]=#" & [Confirm Review Date] & "#")

The user has to enter twice a single Review Date (twice because there are
two connected tables) to get the result of the count. Now I would like to
expand the formula to allow a count for the quarter, which means I would like
to be able to get a count of files for 3 selected review dates instead of
just 1. I would like the user to select or enter in three different review
dates so the formula can calculate the number of files reviewed for those
three dates using the formula above. Any help or suggesstion would be a very
much appreciated!

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

You only need one date to calc for the qtr. Something like this:

Number of Files Reviewed: DCount("*","Files","[Review Date] Between " &
[Start of Quarter Date] & " And " & DateAdd("q", 1, [Start of Quarter
Date])-1)

Set up the Parameters for [Start of Quarter Date] as a DateTime data
type 'cuz you won't have to use the # delimiter in the expression.

The user has to enter the exact 1st date of the beginning of the
quarter. E.g.: 1/1/09 or 4/1/09 or 7/1/09, etc.
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
** Respond only to this newsgroup. I DO NOT respond to emails **

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBSbXtZIechKqOuFEgEQIXUQCg4/Ysd9++u9iJIxBIufLMmjKTDsIAoO5T
0mcf8mnQZDUaEUTwopKOR4Sw
=X1Wn
-----END PGP SIGNATURE-----
 
M

MGFoster

This formula worked on my computer. Please copy & post your formula and
the starting date you enter when the query runs.
--
MGFoster:::mgf00
Oakland, CA (USA)

I tried the formula but it gives me the count of all the files. I have sample
files from 1/1/09 through 5/1/09, and I expect the formula to count only
files from Jan to March, but it counts everything from the beginning date
until the last date I have. Can you help correct this formula so that it
counts only the begin quarter date to the 3rd month after? Or if there is a
formula where I can specify the begin date and the end date, that would be
fine too. Thank so much for your help!

MGFoster said:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Apparently, the # delimiters are needed in the DCount() function;
therefore, change to this:

Number of Files Reviewed: DCount("*","Files","[Review Date] >= #" &
[Start of Quarter Date] & "# And [Review Date] < #" & DateAdd("q", 1,
[Start of Quarter Date]) & "#")

Be sure to enter the first date of the quarter as the [Start of Quarter
Date].

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
** Respond only to this newsgroup. I DO NOT respond to emails **

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBSbdGw4echKqOuFEgEQL1CwCfT3a9uDCBHONSG4xcDaqTlKA3MwYAoLTn
PNaBh5libSmyhN5yVU5YST3Q
=Ib15
-----END PGP SIGNATURE-----


Thank you MG Foster for your input. I tried the formula and kept getting
zero. I have 18 files for the quarter but the formula resulted in 18 zeros
instead of just one number 18. My goal is to have the result for the quarter
in just one number, not for each single files. Can you help?

:

Kaylen wrote:
Good morning,
I have a formula which I need help on expanding to calculate for the
quarter. Currently this is my formula in a query I have:

Number of Files Reviewed: DCount("*","Files","[Review Date] and [Review
Date]=#" & [Confirm Review Date] & "#")

The user has to enter twice a single Review Date (twice because there are
two connected tables) to get the result of the count. Now I would like to
expand the formula to allow a count for the quarter, which means I would like
to be able to get a count of files for 3 selected review dates instead of
just 1. I would like the user to select or enter in three different review
dates so the formula can calculate the number of files reviewed for those
three dates using the formula above. Any help or suggesstion would be a very
much appreciated!
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

You only need one date to calc for the qtr. Something like this:

Number of Files Reviewed: DCount("*","Files","[Review Date] Between " &
[Start of Quarter Date] & " And " & DateAdd("q", 1, [Start of Quarter
Date])-1)

Set up the Parameters for [Start of Quarter Date] as a DateTime data
type 'cuz you won't have to use the # delimiter in the expression.

The user has to enter the exact 1st date of the beginning of the
quarter. E.g.: 1/1/09 or 4/1/09 or 7/1/09, etc.
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
** Respond only to this newsgroup. I DO NOT respond to emails **

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBSbXtZIechKqOuFEgEQIXUQCg4/Ysd9++u9iJIxBIufLMmjKTDsIAoO5T
0mcf8mnQZDUaEUTwopKOR4Sw
=X1Wn
-----END PGP SIGNATURE-----
 
K

Kaylen

You're right, it works now that i recopied and repasted it. Thank you very
much! There is another question I hope you can please help me on. This is the
main formula that I need help making it calculate for the quarter also. Can
you help me modify the formula below so that it calculate for the quarter? It
is similar to the one you have helped me on. I am very grateful for your help!

Question1: IIf(DCount("*","Files","[14] IN ('Y','N') AND [Review Date] =#" &
[Confirm Review Date] & "#")=0,"N/A",FormatPercent((DCount("*","Files","[14]
='Y' and [Review Date]=#" & [Confirm Review Date] &
"#")/DCount("*","Files","[14] IN ('Y','N') and [Review Date]=#" & [Confirm
Review Date] & "#")),0))




MGFoster said:
This formula worked on my computer. Please copy & post your formula and
the starting date you enter when the query runs.
--
MGFoster:::mgf00
Oakland, CA (USA)

I tried the formula but it gives me the count of all the files. I have sample
files from 1/1/09 through 5/1/09, and I expect the formula to count only
files from Jan to March, but it counts everything from the beginning date
until the last date I have. Can you help correct this formula so that it
counts only the begin quarter date to the 3rd month after? Or if there is a
formula where I can specify the begin date and the end date, that would be
fine too. Thank so much for your help!

MGFoster said:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Apparently, the # delimiters are needed in the DCount() function;
therefore, change to this:

Number of Files Reviewed: DCount("*","Files","[Review Date] >= #" &
[Start of Quarter Date] & "# And [Review Date] < #" & DateAdd("q", 1,
[Start of Quarter Date]) & "#")

Be sure to enter the first date of the quarter as the [Start of Quarter
Date].

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
** Respond only to this newsgroup. I DO NOT respond to emails **

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBSbdGw4echKqOuFEgEQL1CwCfT3a9uDCBHONSG4xcDaqTlKA3MwYAoLTn
PNaBh5libSmyhN5yVU5YST3Q
=Ib15
-----END PGP SIGNATURE-----



Kaylen wrote:
Thank you MG Foster for your input. I tried the formula and kept getting
zero. I have 18 files for the quarter but the formula resulted in 18 zeros
instead of just one number 18. My goal is to have the result for the quarter
in just one number, not for each single files. Can you help?

:

Kaylen wrote:
Good morning,
I have a formula which I need help on expanding to calculate for the
quarter. Currently this is my formula in a query I have:

Number of Files Reviewed: DCount("*","Files","[Review Date] and [Review
Date]=#" & [Confirm Review Date] & "#")

The user has to enter twice a single Review Date (twice because there are
two connected tables) to get the result of the count. Now I would like to
expand the formula to allow a count for the quarter, which means I would like
to be able to get a count of files for 3 selected review dates instead of
just 1. I would like the user to select or enter in three different review
dates so the formula can calculate the number of files reviewed for those
three dates using the formula above. Any help or suggesstion would be a very
much appreciated!
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

You only need one date to calc for the qtr. Something like this:

Number of Files Reviewed: DCount("*","Files","[Review Date] Between " &
[Start of Quarter Date] & " And " & DateAdd("q", 1, [Start of Quarter
Date])-1)

Set up the Parameters for [Start of Quarter Date] as a DateTime data
type 'cuz you won't have to use the # delimiter in the expression.

The user has to enter the exact 1st date of the beginning of the
quarter. E.g.: 1/1/09 or 4/1/09 or 7/1/09, etc.
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
** Respond only to this newsgroup. I DO NOT respond to emails **

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBSbXtZIechKqOuFEgEQIXUQCg4/Ysd9++u9iJIxBIufLMmjKTDsIAoO5T
0mcf8mnQZDUaEUTwopKOR4Sw
=X1Wn
-----END PGP SIGNATURE-----
 
M

MGFoster

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hmmm...not too sure that using all those DCount()s is such a good idea.
It could slow down the query a lot 'cuz each occurrence scans the entire
Files table to get it's count. That's three table scans just for one
formula. You could make the expression an alias and use the alias in
other formulas. Example:

SELECT DCount("*", "TableA") AS theCount, theCount/600 As thePct, ...

Anyway, here's the change to your formula:

Question1: IIf(DCount("*","Files","[14] IN ('Y','N') AND [Review Date]
= #" & [Start of Quarter Date] & "# And [Review Date] < #" &
DateAdd("q", 1, [Start of Quarter Date]) & "#") = 0, "N/A",
FormatPercent((DCount("*","Files","[14] = 'Y' And [[Review Date] >= #" &
[Start of Quarter Date] & "# And [Review Date] < #" & DateAdd("q", 1,
[Start of Quarter Date]) & "#")/DCount("*", "Files", "[14] IN ('Y','N')
and [Review Date] >= #" & [Start of Quarter Date] & "# And [Review Date]
< #" & DateAdd("q", 1, [Start of Quarter Date]) & "#")),0))

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
** Respond only to this newsgroup. I DO NOT respond to emails **

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBSbgw2IechKqOuFEgEQJ+GgCeIIaY4hAURSgcD7Kpu8/+3C+T8qcAn29/
azu3tvmx16/3Ynt61cPn0NJz
=5xWy
-----END PGP SIGNATURE-----
You're right, it works now that i recopied and repasted it. Thank you very
much! There is another question I hope you can please help me on. This is the
main formula that I need help making it calculate for the quarter also. Can
you help me modify the formula below so that it calculate for the quarter? It
is similar to the one you have helped me on. I am very grateful for your help!

Question1: IIf(DCount("*","Files","[14] IN ('Y','N') AND [Review Date] =#" &
[Confirm Review Date] & "#")=0,"N/A",FormatPercent((DCount("*","Files","[14]
='Y' and [Review Date]=#" & [Confirm Review Date] &
"#")/DCount("*","Files","[14] IN ('Y','N') and [Review Date]=#" & [Confirm
Review Date] & "#")),0))




MGFoster said:
This formula worked on my computer. Please copy & post your formula and
the starting date you enter when the query runs.
--
MGFoster:::mgf00
Oakland, CA (USA)

I tried the formula but it gives me the count of all the files. I have sample
files from 1/1/09 through 5/1/09, and I expect the formula to count only
files from Jan to March, but it counts everything from the beginning date
until the last date I have. Can you help correct this formula so that it
counts only the begin quarter date to the 3rd month after? Or if there is a
formula where I can specify the begin date and the end date, that would be
fine too. Thank so much for your help!

:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Apparently, the # delimiters are needed in the DCount() function;
therefore, change to this:

Number of Files Reviewed: DCount("*","Files","[Review Date] >= #" &
[Start of Quarter Date] & "# And [Review Date] < #" & DateAdd("q", 1,
[Start of Quarter Date]) & "#")

Be sure to enter the first date of the quarter as the [Start of Quarter
Date].

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
** Respond only to this newsgroup. I DO NOT respond to emails **

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBSbdGw4echKqOuFEgEQL1CwCfT3a9uDCBHONSG4xcDaqTlKA3MwYAoLTn
PNaBh5libSmyhN5yVU5YST3Q
=Ib15
-----END PGP SIGNATURE-----



Kaylen wrote:
Thank you MG Foster for your input. I tried the formula and kept getting
zero. I have 18 files for the quarter but the formula resulted in 18 zeros
instead of just one number 18. My goal is to have the result for the quarter
in just one number, not for each single files. Can you help?

:

Kaylen wrote:
Good morning,
I have a formula which I need help on expanding to calculate for the
quarter. Currently this is my formula in a query I have:

Number of Files Reviewed: DCount("*","Files","[Review Date] and [Review
Date]=#" & [Confirm Review Date] & "#")

The user has to enter twice a single Review Date (twice because there are
two connected tables) to get the result of the count. Now I would like to
expand the formula to allow a count for the quarter, which means I would like
to be able to get a count of files for 3 selected review dates instead of
just 1. I would like the user to select or enter in three different review
dates so the formula can calculate the number of files reviewed for those
three dates using the formula above. Any help or suggesstion would be a very
much appreciated!
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

You only need one date to calc for the qtr. Something like this:

Number of Files Reviewed: DCount("*","Files","[Review Date] Between " &
[Start of Quarter Date] & " And " & DateAdd("q", 1, [Start of Quarter
Date])-1)

Set up the Parameters for [Start of Quarter Date] as a DateTime data
type 'cuz you won't have to use the # delimiter in the expression.

The user has to enter the exact 1st date of the beginning of the
quarter. E.g.: 1/1/09 or 4/1/09 or 7/1/09, etc.
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
** Respond only to this newsgroup. I DO NOT respond to emails **

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBSbXtZIechKqOuFEgEQIXUQCg4/Ysd9++u9iJIxBIufLMmjKTDsIAoO5T
0mcf8mnQZDUaEUTwopKOR4Sw
=X1Wn
-----END PGP SIGNATURE-----
 
K

Kaylen

You're a GENIUS! Thank you sooo soo much. With your expertise, do you know if
there is a way we can modify the formula so that the users can select Begin
Date and an End Date? I ask becuase there are times when the users would only
need the results for only 2 Review Dates, not for the quarter. Is that a
possible modification to this formula? Your suggestion is very valuable.
Thank you so much!


MGFoster said:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hmmm...not too sure that using all those DCount()s is such a good idea.
It could slow down the query a lot 'cuz each occurrence scans the entire
Files table to get it's count. That's three table scans just for one
formula. You could make the expression an alias and use the alias in
other formulas. Example:

SELECT DCount("*", "TableA") AS theCount, theCount/600 As thePct, ...

Anyway, here's the change to your formula:

Question1: IIf(DCount("*","Files","[14] IN ('Y','N') AND [Review Date]
= #" & [Start of Quarter Date] & "# And [Review Date] < #" &
DateAdd("q", 1, [Start of Quarter Date]) & "#") = 0, "N/A",
FormatPercent((DCount("*","Files","[14] = 'Y' And [[Review Date] >= #" &
[Start of Quarter Date] & "# And [Review Date] < #" & DateAdd("q", 1,
[Start of Quarter Date]) & "#")/DCount("*", "Files", "[14] IN ('Y','N')
and [Review Date] >= #" & [Start of Quarter Date] & "# And [Review Date]
< #" & DateAdd("q", 1, [Start of Quarter Date]) & "#")),0))

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
** Respond only to this newsgroup. I DO NOT respond to emails **

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBSbgw2IechKqOuFEgEQJ+GgCeIIaY4hAURSgcD7Kpu8/+3C+T8qcAn29/
azu3tvmx16/3Ynt61cPn0NJz
=5xWy
-----END PGP SIGNATURE-----
You're right, it works now that i recopied and repasted it. Thank you very
much! There is another question I hope you can please help me on. This is the
main formula that I need help making it calculate for the quarter also. Can
you help me modify the formula below so that it calculate for the quarter? It
is similar to the one you have helped me on. I am very grateful for your help!

Question1: IIf(DCount("*","Files","[14] IN ('Y','N') AND [Review Date] =#" &
[Confirm Review Date] & "#")=0,"N/A",FormatPercent((DCount("*","Files","[14]
='Y' and [Review Date]=#" & [Confirm Review Date] &
"#")/DCount("*","Files","[14] IN ('Y','N') and [Review Date]=#" & [Confirm
Review Date] & "#")),0))




MGFoster said:
This formula worked on my computer. Please copy & post your formula and
the starting date you enter when the query runs.
--
MGFoster:::mgf00
Oakland, CA (USA)


Kaylen wrote:
I tried the formula but it gives me the count of all the files. I have sample
files from 1/1/09 through 5/1/09, and I expect the formula to count only
files from Jan to March, but it counts everything from the beginning date
until the last date I have. Can you help correct this formula so that it
counts only the begin quarter date to the 3rd month after? Or if there is a
formula where I can specify the begin date and the end date, that would be
fine too. Thank so much for your help!

:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Apparently, the # delimiters are needed in the DCount() function;
therefore, change to this:

Number of Files Reviewed: DCount("*","Files","[Review Date] >= #" &
[Start of Quarter Date] & "# And [Review Date] < #" & DateAdd("q", 1,
[Start of Quarter Date]) & "#")

Be sure to enter the first date of the quarter as the [Start of Quarter
Date].

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
** Respond only to this newsgroup. I DO NOT respond to emails **

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBSbdGw4echKqOuFEgEQL1CwCfT3a9uDCBHONSG4xcDaqTlKA3MwYAoLTn
PNaBh5libSmyhN5yVU5YST3Q
=Ib15
-----END PGP SIGNATURE-----



Kaylen wrote:
Thank you MG Foster for your input. I tried the formula and kept getting
zero. I have 18 files for the quarter but the formula resulted in 18 zeros
instead of just one number 18. My goal is to have the result for the quarter
in just one number, not for each single files. Can you help?

:

Kaylen wrote:
Good morning,
I have a formula which I need help on expanding to calculate for the
quarter. Currently this is my formula in a query I have:

Number of Files Reviewed: DCount("*","Files","[Review Date] and [Review
Date]=#" & [Confirm Review Date] & "#")

The user has to enter twice a single Review Date (twice because there are
two connected tables) to get the result of the count. Now I would like to
expand the formula to allow a count for the quarter, which means I would like
to be able to get a count of files for 3 selected review dates instead of
just 1. I would like the user to select or enter in three different review
dates so the formula can calculate the number of files reviewed for those
three dates using the formula above. Any help or suggesstion would be a very
much appreciated!
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

You only need one date to calc for the qtr. Something like this:

Number of Files Reviewed: DCount("*","Files","[Review Date] Between " &
[Start of Quarter Date] & " And " & DateAdd("q", 1, [Start of Quarter
Date])-1)

Set up the Parameters for [Start of Quarter Date] as a DateTime data
type 'cuz you won't have to use the # delimiter in the expression.

The user has to enter the exact 1st date of the beginning of the
quarter. E.g.: 1/1/09 or 4/1/09 or 7/1/09, etc.
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
** Respond only to this newsgroup. I DO NOT respond to emails **

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBSbXtZIechKqOuFEgEQIXUQCg4/Ysd9++u9iJIxBIufLMmjKTDsIAoO5T
0mcf8mnQZDUaEUTwopKOR4Sw
=X1Wn
-----END PGP SIGNATURE-----
 
M

MGFoster

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

You could just ask for the start date and how many months the query
should cover and use that number in the formula like this:

DCount("*","Files","[Review Date] >= #" & [Start Date] & "# AND [Review
Date] < #" DateAdd("m",[Number of Months],[Start Date]) & "#")

If the user entered 1/1/09 as the [Start Date] and 2 as the [Number of
Months] the date range would be 1/1/09 to 2/28/09.

In the current formula just replace the substrings that start with
[Review Date] and end with [Start of Quarter Date] with the substring in
the above formula that starts with [Review Date] and ends with [Start
Date]. If it gets too confusing copy & paste the whole formula in a
Notepad file and break the formula apart into its separate components.
Then make the changes and re-assemble the formula (just remove the new
line characters) and paste it back into your query design grid.
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
** Respond only to this newsgroup. I DO NOT respond to emails **

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBSbhRy4echKqOuFEgEQKq8QCg7UG1gUSdGtfAzmi0epuyqfj1MAcAoKVU
e1Q6P8VnoCL/rAj+LpSEMAP8
=QERD
-----END PGP SIGNATURE-----
You're a GENIUS! Thank you sooo soo much. With your expertise, do you know if
there is a way we can modify the formula so that the users can select Begin
Date and an End Date? I ask becuase there are times when the users would only
need the results for only 2 Review Dates, not for the quarter. Is that a
possible modification to this formula? Your suggestion is very valuable.
Thank you so much!


MGFoster said:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hmmm...not too sure that using all those DCount()s is such a good idea.
It could slow down the query a lot 'cuz each occurrence scans the entire
Files table to get it's count. That's three table scans just for one
formula. You could make the expression an alias and use the alias in
other formulas. Example:

SELECT DCount("*", "TableA") AS theCount, theCount/600 As thePct, ...

Anyway, here's the change to your formula:

Question1: IIf(DCount("*","Files","[14] IN ('Y','N') AND [Review Date]
= #" & [Start of Quarter Date] & "# And [Review Date] < #" &
DateAdd("q", 1, [Start of Quarter Date]) & "#") = 0, "N/A",
FormatPercent((DCount("*","Files","[14] = 'Y' And [[Review Date] >= #" &
[Start of Quarter Date] & "# And [Review Date] < #" & DateAdd("q", 1,
[Start of Quarter Date]) & "#")/DCount("*", "Files", "[14] IN ('Y','N')
and [Review Date] >= #" & [Start of Quarter Date] & "# And [Review Date]
< #" & DateAdd("q", 1, [Start of Quarter Date]) & "#")),0))

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
** Respond only to this newsgroup. I DO NOT respond to emails **

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBSbgw2IechKqOuFEgEQJ+GgCeIIaY4hAURSgcD7Kpu8/+3C+T8qcAn29/
azu3tvmx16/3Ynt61cPn0NJz
=5xWy
-----END PGP SIGNATURE-----
You're right, it works now that i recopied and repasted it. Thank you very
much! There is another question I hope you can please help me on. This is the
main formula that I need help making it calculate for the quarter also. Can
you help me modify the formula below so that it calculate for the quarter? It
is similar to the one you have helped me on. I am very grateful for your help!

Question1: IIf(DCount("*","Files","[14] IN ('Y','N') AND [Review Date] =#" &
[Confirm Review Date] & "#")=0,"N/A",FormatPercent((DCount("*","Files","[14]
='Y' and [Review Date]=#" & [Confirm Review Date] &
"#")/DCount("*","Files","[14] IN ('Y','N') and [Review Date]=#" & [Confirm
Review Date] & "#")),0))




:

This formula worked on my computer. Please copy & post your formula and
the starting date you enter when the query runs.
--
MGFoster:::mgf00
Oakland, CA (USA)


Kaylen wrote:
I tried the formula but it gives me the count of all the files. I have sample
files from 1/1/09 through 5/1/09, and I expect the formula to count only
files from Jan to March, but it counts everything from the beginning date
until the last date I have. Can you help correct this formula so that it
counts only the begin quarter date to the 3rd month after? Or if there is a
formula where I can specify the begin date and the end date, that would be
fine too. Thank so much for your help!

:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Apparently, the # delimiters are needed in the DCount() function;
therefore, change to this:

Number of Files Reviewed: DCount("*","Files","[Review Date] >= #" &
[Start of Quarter Date] & "# And [Review Date] < #" & DateAdd("q", 1,
[Start of Quarter Date]) & "#")

Be sure to enter the first date of the quarter as the [Start of Quarter
Date].

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
** Respond only to this newsgroup. I DO NOT respond to emails **

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBSbdGw4echKqOuFEgEQL1CwCfT3a9uDCBHONSG4xcDaqTlKA3MwYAoLTn
PNaBh5libSmyhN5yVU5YST3Q
=Ib15
-----END PGP SIGNATURE-----



Kaylen wrote:
Thank you MG Foster for your input. I tried the formula and kept getting
zero. I have 18 files for the quarter but the formula resulted in 18 zeros
instead of just one number 18. My goal is to have the result for the quarter
in just one number, not for each single files. Can you help?

:

Kaylen wrote:
Good morning,
I have a formula which I need help on expanding to calculate for the
quarter. Currently this is my formula in a query I have:

Number of Files Reviewed: DCount("*","Files","[Review Date] and [Review
Date]=#" & [Confirm Review Date] & "#")

The user has to enter twice a single Review Date (twice because there are
two connected tables) to get the result of the count. Now I would like to
expand the formula to allow a count for the quarter, which means I would like
to be able to get a count of files for 3 selected review dates instead of
just 1. I would like the user to select or enter in three different review
dates so the formula can calculate the number of files reviewed for those
three dates using the formula above. Any help or suggesstion would be a very
much appreciated!
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

You only need one date to calc for the qtr. Something like this:

Number of Files Reviewed: DCount("*","Files","[Review Date] Between " &
[Start of Quarter Date] & " And " & DateAdd("q", 1, [Start of Quarter
Date])-1)

Set up the Parameters for [Start of Quarter Date] as a DateTime data
type 'cuz you won't have to use the # delimiter in the expression.

The user has to enter the exact 1st date of the beginning of the
quarter. E.g.: 1/1/09 or 4/1/09 or 7/1/09, etc.
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
** Respond only to this newsgroup. I DO NOT respond to emails **

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBSbXtZIechKqOuFEgEQIXUQCg4/Ysd9++u9iJIxBIufLMmjKTDsIAoO5T
0mcf8mnQZDUaEUTwopKOR4Sw
=X1Wn
-----END PGP SIGNATURE-----
 
K

Kaylen

Thank you! I modified the formula the way you advised and it works! However,
when I entered in the Start date of 1/2/09, and 1 as the # of Months, I got
the wrong results. In my sample data, I have

8 files with Review Dates of 1/1/09
1 file with Review Date 1/2/09
9 files with Review Dates 2/1/09.

I entered 1/2/09 as the Start date and 1 as the number of months, I got the
result of 10 Fles Reviewed. It suppose to be 1. When I enter the month and
the day of 1 like 1/1/09 or 2/1/09, I got the correct results. Any idea why
this the result is wrong for 1/2/09? Does the formula only recognizes the
start date (1) of the month and not any other dates? If so, then that would
be a problem because my goal is to be able to get the results for any range
of Review Dates with any starting date. Please advise. You have been very
helpful to me!

MGFoster said:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

You could just ask for the start date and how many months the query
should cover and use that number in the formula like this:

DCount("*","Files","[Review Date] >= #" & [Start Date] & "# AND [Review
Date] < #" DateAdd("m",[Number of Months],[Start Date]) & "#")

If the user entered 1/1/09 as the [Start Date] and 2 as the [Number of
Months] the date range would be 1/1/09 to 2/28/09.

In the current formula just replace the substrings that start with
[Review Date] and end with [Start of Quarter Date] with the substring in
the above formula that starts with [Review Date] and ends with [Start
Date]. If it gets too confusing copy & paste the whole formula in a
Notepad file and break the formula apart into its separate components.
Then make the changes and re-assemble the formula (just remove the new
line characters) and paste it back into your query design grid.
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
** Respond only to this newsgroup. I DO NOT respond to emails **

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBSbhRy4echKqOuFEgEQKq8QCg7UG1gUSdGtfAzmi0epuyqfj1MAcAoKVU
e1Q6P8VnoCL/rAj+LpSEMAP8
=QERD
-----END PGP SIGNATURE-----
You're a GENIUS! Thank you sooo soo much. With your expertise, do you know if
there is a way we can modify the formula so that the users can select Begin
Date and an End Date? I ask becuase there are times when the users would only
need the results for only 2 Review Dates, not for the quarter. Is that a
possible modification to this formula? Your suggestion is very valuable.
Thank you so much!


MGFoster said:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hmmm...not too sure that using all those DCount()s is such a good idea.
It could slow down the query a lot 'cuz each occurrence scans the entire
Files table to get it's count. That's three table scans just for one
formula. You could make the expression an alias and use the alias in
other formulas. Example:

SELECT DCount("*", "TableA") AS theCount, theCount/600 As thePct, ...

Anyway, here's the change to your formula:

Question1: IIf(DCount("*","Files","[14] IN ('Y','N') AND [Review Date]
= #" & [Start of Quarter Date] & "# And [Review Date] < #" &
DateAdd("q", 1, [Start of Quarter Date]) & "#") = 0, "N/A",
FormatPercent((DCount("*","Files","[14] = 'Y' And [[Review Date] >= #" &
[Start of Quarter Date] & "# And [Review Date] < #" & DateAdd("q", 1,
[Start of Quarter Date]) & "#")/DCount("*", "Files", "[14] IN ('Y','N')
and [Review Date] >= #" & [Start of Quarter Date] & "# And [Review Date]
< #" & DateAdd("q", 1, [Start of Quarter Date]) & "#")),0))

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
** Respond only to this newsgroup. I DO NOT respond to emails **

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBSbgw2IechKqOuFEgEQJ+GgCeIIaY4hAURSgcD7Kpu8/+3C+T8qcAn29/
azu3tvmx16/3Ynt61cPn0NJz
=5xWy
-----END PGP SIGNATURE-----

Kaylen wrote:
You're right, it works now that i recopied and repasted it. Thank you very
much! There is another question I hope you can please help me on. This is the
main formula that I need help making it calculate for the quarter also. Can
you help me modify the formula below so that it calculate for the quarter? It
is similar to the one you have helped me on. I am very grateful for your help!

Question1: IIf(DCount("*","Files","[14] IN ('Y','N') AND [Review Date] =#" &
[Confirm Review Date] & "#")=0,"N/A",FormatPercent((DCount("*","Files","[14]
='Y' and [Review Date]=#" & [Confirm Review Date] &
"#")/DCount("*","Files","[14] IN ('Y','N') and [Review Date]=#" & [Confirm
Review Date] & "#")),0))




:

This formula worked on my computer. Please copy & post your formula and
the starting date you enter when the query runs.
--
MGFoster:::mgf00
Oakland, CA (USA)


Kaylen wrote:
I tried the formula but it gives me the count of all the files. I have sample
files from 1/1/09 through 5/1/09, and I expect the formula to count only
files from Jan to March, but it counts everything from the beginning date
until the last date I have. Can you help correct this formula so that it
counts only the begin quarter date to the 3rd month after? Or if there is a
formula where I can specify the begin date and the end date, that would be
fine too. Thank so much for your help!

:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Apparently, the # delimiters are needed in the DCount() function;
therefore, change to this:

Number of Files Reviewed: DCount("*","Files","[Review Date] >= #" &
[Start of Quarter Date] & "# And [Review Date] < #" & DateAdd("q", 1,
[Start of Quarter Date]) & "#")

Be sure to enter the first date of the quarter as the [Start of Quarter
Date].

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
** Respond only to this newsgroup. I DO NOT respond to emails **

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBSbdGw4echKqOuFEgEQL1CwCfT3a9uDCBHONSG4xcDaqTlKA3MwYAoLTn
PNaBh5libSmyhN5yVU5YST3Q
=Ib15
-----END PGP SIGNATURE-----



Kaylen wrote:
Thank you MG Foster for your input. I tried the formula and kept getting
zero. I have 18 files for the quarter but the formula resulted in 18 zeros
instead of just one number 18. My goal is to have the result for the quarter
in just one number, not for each single files. Can you help?

:

Kaylen wrote:
Good morning,
I have a formula which I need help on expanding to calculate for the
quarter. Currently this is my formula in a query I have:

Number of Files Reviewed: DCount("*","Files","[Review Date] and [Review
Date]=#" & [Confirm Review Date] & "#")

The user has to enter twice a single Review Date (twice because there are
two connected tables) to get the result of the count. Now I would like to
expand the formula to allow a count for the quarter, which means I would like
to be able to get a count of files for 3 selected review dates instead of
just 1. I would like the user to select or enter in three different review
dates so the formula can calculate the number of files reviewed for those
three dates using the formula above. Any help or suggesstion would be a very
much appreciated!
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

You only need one date to calc for the qtr. Something like this:

Number of Files Reviewed: DCount("*","Files","[Review Date] Between " &
[Start of Quarter Date] & " And " & DateAdd("q", 1, [Start of Quarter
Date])-1)

Set up the Parameters for [Start of Quarter Date] as a DateTime data
type 'cuz you won't have to use the # delimiter in the expression.

The user has to enter the exact 1st date of the beginning of the
quarter. E.g.: 1/1/09 or 4/1/09 or 7/1/09, etc.
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
** Respond only to this newsgroup. I DO NOT respond to emails **

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBSbXtZIechKqOuFEgEQIXUQCg4/Ysd9++u9iJIxBIufLMmjKTDsIAoO5T
0mcf8mnQZDUaEUTwopKOR4Sw
=X1Wn
-----END PGP SIGNATURE-----
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top