If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Averages... Could you please Help Me?
I am Portuguese woman and I am a novice using MS Access databases.
I am now in charge of analyzing the data gathered from a Questionnaire distributed to 235 persons in my company and I decided to create a database using the Access. The Questionnaire has 21 questions and each question is answered with a number that goes from 1 (Entirely Unsatisfied) to 5 (Entirely Satisfied). This is a simple database, where I used a Table, a Form, some simple queries and simple reports. It was quite easy to make queries to give me the averages of each question (by using the wizard) but it started to become difficult to find out how to get the average of some average values. Even though I made it and it works, but maybe not the better way. This is an example of how I made it in the Query: =avg([fieldname]+ [fieldname])/2. This expression works even if not all the 21 fields have a value. I mean, if I leave a field blank, the Query gives me the average of that same field for all the existing Questionnaires. Anyway, and hoping that you understand my English and my explanation, I wanted to use an expression in my Form to give me the global average value for each Questionnaire as I am introducing the values. This is how I made it in the text box: =([fieldname1]+ [fieldname2]+….. [fieldname21])/21 (number of questions in the questionnaire). It worked up to the moment where I started to have some Questionnaires with some fields left blank….. The Queries do not mind to find some fields blank but the expression I used in the Form seems to not work when it finds a field blank…. I also tried to make a query to give me the average value for each questionnaire (from question1 to question21) but it didn’t work, anyway. Is there a way for you to help me, in case you did understand what I wrote? I sincerely hope so because I can’t succeed by simple reading the MS Access Help….. |
#2
|
|||
|
|||
The problem is that, when you attempt to add a NULL value to anything it
returns NULL. There is a function that will change the NULL values to 0 and let your proceed. =(Nz([fieldname1],0) + Nz([fieldname2],0) +... Nz([fieldname21],0))/21 -- Lynn Trapp MS Access MVP www.ltcomputerdesigns.com Access Security: www.ltcomputerdesigns.com/Security.htm "Jlia" wrote in message ... I am Portuguese woman and I am a novice using MS Access databases. I am now in charge of analyzing the data gathered from a Questionnaire distributed to 235 persons in my company and I decided to create a database using the Access. The Questionnaire has 21 questions and each question is answered with a number that goes from 1 (Entirely Unsatisfied) to 5 (Entirely Satisfied). This is a simple database, where I used a Table, a Form, some simple queries and simple reports. It was quite easy to make queries to give me the averages of each question (by using the wizard) but it started to become difficult to find out how to get the average of some average values. Even though I made it and it works, but maybe not the better way. This is an example of how I made it in the Query: =avg([fieldname]+ [fieldname])/2. This expression works even if not all the 21 fields have a value. I mean, if I leave a field blank, the Query gives me the average of that same field for all the existing Questionnaires. Anyway, and hoping that you understand my English and my explanation, I wanted to use an expression in my Form to give me the global average value for each Questionnaire as I am introducing the values. This is how I made it in the text box: =([fieldname1]+ [fieldname2]+... [fieldname21])/21 (number of questions in the questionnaire). It worked up to the moment where I started to have some Questionnaires with some fields left blank... The Queries do not mind to find some fields blank but the expression I used in the Form seems to not work when it finds a field blank.. I also tried to make a query to give me the average value for each questionnaire (from question1 to question21) but it didn't work, anyway. Is there a way for you to help me, in case you did understand what I wrote? I sincerely hope so because I can't succeed by simple reading the MS Access Help... |
#3
|
|||
|
|||
The problem with that method is tht a null value will be=20
treated as a zero for the average. That isn't want you=20 want. For Example, consider: 2 4 Null The average SHOULD be 3, but your average will be 2. Try: =3D(Nz([fieldname1],0) + Nz([fieldname2],0) +... Nz ([fieldname21],0))/ABS(IsNull(Field1) + IsNull(Field2)=20 + ...) Chris Nebinger -----Original Message----- The problem is that, when you attempt to add a NULL value=20 to anything it returns NULL. There is a function that will change the=20 NULL values to 0 and let your proceed. =3D(Nz([fieldname1],0) + Nz([fieldname2],0) +... Nz ([fieldname21],0))/21 --=20 Lynn Trapp MS Access MVP www.ltcomputerdesigns.com Access Security: www.ltcomputerdesigns.com/Security.htm "J=FAlia" wrote in message ... I am Portuguese woman and I am a novice using MS Access=20 databases. I am now in charge of analyzing the data gathered from=20 a Questionnaire distributed to 235 persons in my company and I decided=20 to create a database using the Access. The Questionnaire has 21 questions and each question is=20 answered with a number that goes from 1 (Entirely Unsatisfied) to 5=20 (Entirely Satisfied). This is a simple database, where I used a Table, a=20 Form, some simple queries and simple reports. It was quite easy to make queries to give me the=20 averages of each question (by using the wizard) but it started to become=20 difficult to find out how to get the average of some average values. Even though I=20 made it and it works, but maybe not the better way. This is an example of how=20 I made it in the Query: =3Davg([fieldname]+ [fieldname])/2. This=20 expression works even if not all the 21 fields have a value. I mean, if I leave a=20 field blank, the Query gives me the average of that same field for all the=20 existing Questionnaires. Anyway, and hoping that you understand my English and=20 my explanation, I wanted to use an expression in my Form to give me the=20 global average value for each Questionnaire as I am introducing the values.=20 This is how I made it in the text box: =3D([fieldname1]+ [fieldname2]+...=20 [fieldname21])/21 (number of questions in the questionnaire). It worked up to the=20 moment where I started to have some Questionnaires with some fields=20 left blank... The Queries do not mind to find some fields blank but=20 the expression I used in the Form seems to not work when it finds a field=20 blank.. I also tried to make a query to give me the average value for each=20 questionnaire (from question1 to question21) but it didn't work, anyway. Is there a way for you to help me, in case you did=20 understand what I wrote? I sincerely hope so because I can't succeed by simple=20 reading the MS Access Help... . |
#4
|
|||
|
|||
So right! Thanks for catching that Chris.
-- Lynn Trapp MS Access MVP www.ltcomputerdesigns.com Access Security: www.ltcomputerdesigns.com/Security.htm "Chris Nebinger" wrote in message ... The problem with that method is tht a null value will be treated as a zero for the average. That isn't want you want. For Example, consider: 2 4 Null The average SHOULD be 3, but your average will be 2. Try: =(Nz([fieldname1],0) + Nz([fieldname2],0) +... Nz ([fieldname21],0))/ABS(IsNull(Field1) + IsNull(Field2) + ...) Chris Nebinger -----Original Message----- The problem is that, when you attempt to add a NULL value to anything it returns NULL. There is a function that will change the NULL values to 0 and let your proceed. =(Nz([fieldname1],0) + Nz([fieldname2],0) +... Nz ([fieldname21],0))/21 -- Lynn Trapp MS Access MVP www.ltcomputerdesigns.com Access Security: www.ltcomputerdesigns.com/Security.htm "Jlia" wrote in message ... I am Portuguese woman and I am a novice using MS Access databases. I am now in charge of analyzing the data gathered from a Questionnaire distributed to 235 persons in my company and I decided to create a database using the Access. The Questionnaire has 21 questions and each question is answered with a number that goes from 1 (Entirely Unsatisfied) to 5 (Entirely Satisfied). This is a simple database, where I used a Table, a Form, some simple queries and simple reports. It was quite easy to make queries to give me the averages of each question (by using the wizard) but it started to become difficult to find out how to get the average of some average values. Even though I made it and it works, but maybe not the better way. This is an example of how I made it in the Query: =avg([fieldname]+ [fieldname])/2. This expression works even if not all the 21 fields have a value. I mean, if I leave a field blank, the Query gives me the average of that same field for all the existing Questionnaires. Anyway, and hoping that you understand my English and my explanation, I wanted to use an expression in my Form to give me the global average value for each Questionnaire as I am introducing the values. This is how I made it in the text box: =([fieldname1]+ [fieldname2]+... [fieldname21])/21 (number of questions in the questionnaire). It worked up to the moment where I started to have some Questionnaires with some fields left blank... The Queries do not mind to find some fields blank but the expression I used in the Form seems to not work when it finds a field blank.. I also tried to make a query to give me the average value for each questionnaire (from question1 to question21) but it didn't work, anyway. Is there a way for you to help me, in case you did understand what I wrote? I sincerely hope so because I can't succeed by simple reading the MS Access Help... . |
#6
|
|||
|
|||
g
-- Lynn Trapp MS Access MVP www.ltcomputerdesigns.com Access Security: www.ltcomputerdesigns.com/Security.htm "Chris Nebinger" wrote in message ... How do you think I originally found that quirk? A user yelled asking why couldn't I do a simple average? Chris Nebinger -----Original Message----- So right! Thanks for catching that Chris. -- Lynn Trapp MS Access MVP www.ltcomputerdesigns.com Access Security: www.ltcomputerdesigns.com/Security.htm "Chris Nebinger" wrote in message ... The problem with that method is tht a null value will be treated as a zero for the average. That isn't want you want. For Example, consider: 2 4 Null The average SHOULD be 3, but your average will be 2. Try: =(Nz([fieldname1],0) + Nz([fieldname2],0) +... Nz ([fieldname21],0))/ABS(IsNull(Field1) + IsNull(Field2) + ...) Chris Nebinger -----Original Message----- The problem is that, when you attempt to add a NULL value to anything it returns NULL. There is a function that will change the NULL values to 0 and let your proceed. =(Nz([fieldname1],0) + Nz([fieldname2],0) +... Nz ([fieldname21],0))/21 -- Lynn Trapp MS Access MVP www.ltcomputerdesigns.com Access Security: www.ltcomputerdesigns.com/Security.htm "Jlia" wrote in message news:92EBEBA5-DD2A-44A8-8C69- ... I am Portuguese woman and I am a novice using MS Access databases. I am now in charge of analyzing the data gathered from a Questionnaire distributed to 235 persons in my company and I decided to create a database using the Access. The Questionnaire has 21 questions and each question is answered with a number that goes from 1 (Entirely Unsatisfied) to 5 (Entirely Satisfied). This is a simple database, where I used a Table, a Form, some simple queries and simple reports. It was quite easy to make queries to give me the averages of each question (by using the wizard) but it started to become difficult to find out how to get the average of some average values. Even though I made it and it works, but maybe not the better way. This is an example of how I made it in the Query: =avg([fieldname]+ [fieldname])/2. This expression works even if not all the 21 fields have a value. I mean, if I leave a field blank, the Query gives me the average of that same field for all the existing Questionnaires. Anyway, and hoping that you understand my English and my explanation, I wanted to use an expression in my Form to give me the global average value for each Questionnaire as I am introducing the values. This is how I made it in the text box: =([fieldname1]+ [fieldname2]+... [fieldname21])/21 (number of questions in the questionnaire). It worked up to the moment where I started to have some Questionnaires with some fields left blank... The Queries do not mind to find some fields blank but the expression I used in the Form seems to not work when it finds a field blank.. I also tried to make a query to give me the average value for each questionnaire (from question1 to question21) but it didn't work, anyway. Is there a way for you to help me, in case you did understand what I wrote? I sincerely hope so because I can't succeed by simple reading the MS Access Help... . . |
#7
|
|||
|
|||
Hi, Chris
I want to thank you and Lynn for your help. I think your suggestion will be the solution. I will try to use it in my form, as in the queries the problem does not exist (when I make a query by using the wizard and tell I want a given field averaged, Null values are not included in the final average). The only problem was to get the average of a questionnaire when that questionnaire did not have all questions answered. I'm going to try your suggestion immediately, Chris. Thanks a lot. :-)))))))) "Chris Nebinger" escreveu: How do you think I originally found that quirk? A user yelled asking why couldn't I do a simple average? Chris Nebinger -----Original Message----- So right! Thanks for catching that Chris. -- Lynn Trapp MS Access MVP www.ltcomputerdesigns.com Access Security: www.ltcomputerdesigns.com/Security.htm "Chris Nebinger" wrote in message ... The problem with that method is tht a null value will be treated as a zero for the average. That isn't want you want. For Example, consider: 2 4 Null The average SHOULD be 3, but your average will be 2. Try: =(Nz([fieldname1],0) + Nz([fieldname2],0) +... Nz ([fieldname21],0))/ABS(IsNull(Field1) + IsNull(Field2) + ...) Chris Nebinger -----Original Message----- The problem is that, when you attempt to add a NULL value to anything it returns NULL. There is a function that will change the NULL values to 0 and let your proceed. =(Nz([fieldname1],0) + Nz([fieldname2],0) +... Nz ([fieldname21],0))/21 -- Lynn Trapp MS Access MVP www.ltcomputerdesigns.com Access Security: www.ltcomputerdesigns.com/Security.htm "Júlia" wrote in message news:92EBEBA5-DD2A-44A8-8C69- ... I am Portuguese woman and I am a novice using MS Access databases. I am now in charge of analyzing the data gathered from a Questionnaire distributed to 235 persons in my company and I decided to create a database using the Access. The Questionnaire has 21 questions and each question is answered with a number that goes from 1 (Entirely Unsatisfied) to 5 (Entirely Satisfied). This is a simple database, where I used a Table, a Form, some simple queries and simple reports. It was quite easy to make queries to give me the averages of each question (by using the wizard) but it started to become difficult to find out how to get the average of some average values. Even though I made it and it works, but maybe not the better way. This is an example of how I made it in the Query: =avg([fieldname]+ [fieldname])/2. This expression works even if not all the 21 fields have a value. I mean, if I leave a field blank, the Query gives me the average of that same field for all the existing Questionnaires. Anyway, and hoping that you understand my English and my explanation, I wanted to use an expression in my Form to give me the global average value for each Questionnaire as I am introducing the values. This is how I made it in the text box: =([fieldname1]+ [fieldname2]+... [fieldname21])/21 (number of questions in the questionnaire). It worked up to the moment where I started to have some Questionnaires with some fields left blank... The Queries do not mind to find some fields blank but the expression I used in the Form seems to not work when it finds a field blank.. I also tried to make a query to give me the average value for each questionnaire (from question1 to question21) but it didn't work, anyway. Is there a way for you to help me, in case you did understand what I wrote? I sincerely hope so because I can't succeed by simple reading the MS Access Help... . . |
#8
|
|||
|
|||
Julia,=20
Are you Italian or Portugese? I saw: "Chris Nebinger" escreveu: I recognize escreveu as being close to the Spanish=20 Escribir, but I can't pin down the language. Anyway, good luck! -----Original Message----- Hi, Chris I want to thank you and Lynn for your help. I think your suggestion will be the solution. I will try=20 to use it in my=20 form, as in the queries the problem does not exist (when=20 I make a query by=20 using the wizard and tell I want a given field averaged,=20 Null values are not=20 included in the final average). The only problem was to=20 get the average of a=20 questionnaire when that questionnaire did not have all=20 questions answered. I'm going to try your suggestion immediately, Chris. Thanks a lot. :-)))))))) "Chris Nebinger" escreveu: How do you think I originally found that quirk? =20 A user yelled asking why couldn't I do a simple average? =20 =20 Chris Nebinger =20 =20 -----Original Message----- So right! Thanks for catching that Chris. --=20 Lynn Trapp MS Access MVP www.ltcomputerdesigns.com Access Security: www.ltcomputerdesigns.com/Security.htm "Chris Nebinger" =20 wrote in message ... The problem with that method is tht a null value will=20 be treated as a zero for the average. That isn't want you want. For Example, consider: 2 4 Null The average SHOULD be 3, but your average will be 2. Try: =3D(Nz([fieldname1],0) + Nz([fieldname2],0) +... Nz ([fieldname21],0))/ABS(IsNull(Field1) + IsNull(Field2) + ...) Chris Nebinger -----Original Message----- The problem is that, when you attempt to add a NULL=20 value to anything it returns NULL. There is a function that will change the NULL values to 0 and let your proceed. =3D(Nz([fieldname1],0) + Nz([fieldname2],0) +... Nz ([fieldname21],0))/21 --=20 Lynn Trapp MS Access MVP www.ltcomputerdesigns.com Access Security:=20 www.ltcomputerdesigns.com/Security.htm "J=C3=BAlia" wrote in=20 message news:92EBEBA5-DD2A-44A8-8C69- ... I am Portuguese woman and I am a novice using MS=20 Access databases. I am now in charge of analyzing the data gathered=20 from a Questionnaire distributed to 235 persons in my company and I=20 decided to create a database using the Access. The Questionnaire has 21 questions and each=20 question is answered with a number that goes from 1 (Entirely Unsatisfied) to 5 (Entirely Satisfied). This is a simple database, where I used a Table, a Form, some simple queries and simple reports. It was quite easy to make queries to give me the averages of each question (by using the wizard) but it started to become difficult to find out how to get the average of some average values. Even though=20 I made it and it works, but maybe not the better way. This is an example of=20 how I made it in the Query: =3Davg([fieldname]+ [fieldname])/2. This expression works even if not all the 21 fields have a value. I mean, if I leave a field blank, the Query gives me the average of that same field for all the existing Questionnaires. Anyway, and hoping that you understand my English=20 and my explanation, I wanted to use an expression in my Form to give me=20 the global average value for each Questionnaire as I am introducing the=20 values. This is how I made it in the text box: =3D([fieldname1]+ [fieldname2]+... [fieldname21])/21 (number of questions in the questionnaire). It worked up to=20 the moment where I started to have some Questionnaires with some fields left blank... The Queries do not mind to find some fields blank=20 but the expression I used in the Form seems to not work when it finds a field blank.. I also tried to make a query to give me the average value for each questionnaire (from question1 to question21) but it didn't work, anyway. Is there a way for you to help me, in case you did understand what I wrote? I sincerely hope so because I can't succeed by=20 simple reading the MS Access Help... . . =20 . |
#9
|
|||
|
|||
Hi, Chris
I am Portuguese. Yes, the Portuguese language is very close to the Spanish language )) The verb is "Escrever" (to write). Portugal is a little country, next to Spain, and full of great people )))) Well, I tried to execute your expression so many times.... It's a very big and confuse expression just to get a simple average but anyway I attempted desperately to execute it because I need to fins a solution to have the averages of each questionnaire (in a form or in a query) even if the questionnaire is not fully answered. But, It didn't work. Maybe it was my mistake but I'm going to quit as I always get this answer: “The expression you entered contains invalid syntax. You omitted an operand or operator, you entered invalid character or comma, or you entered text without surrounding it in quotation marks”. Do you know any other solution in the MS Access or is it better to make it in the Excel? Thanks a lot for your help. Júlia "Chris Nebinger" escreveu: Julia, Are you Italian or Portugese? I saw: "Chris Nebinger" escreveu: I recognize escreveu as being close to the Spanish Escribir, but I can't pin down the language. Anyway, good luck! -----Original Message----- Hi, Chris I want to thank you and Lynn for your help. I think your suggestion will be the solution. I will try to use it in my form, as in the queries the problem does not exist (when I make a query by using the wizard and tell I want a given field averaged, Null values are not included in the final average). The only problem was to get the average of a questionnaire when that questionnaire did not have all questions answered. I'm going to try your suggestion immediately, Chris. Thanks a lot. :-)))))))) "Chris Nebinger" escreveu: How do you think I originally found that quirk? A user yelled asking why couldn't I do a simple average? Chris Nebinger -----Original Message----- So right! Thanks for catching that Chris. -- Lynn Trapp MS Access MVP www.ltcomputerdesigns.com Access Security: www.ltcomputerdesigns.com/Security.htm "Chris Nebinger" wrote in message ... The problem with that method is tht a null value will be treated as a zero for the average. That isn't want you want. For Example, consider: 2 4 Null The average SHOULD be 3, but your average will be 2. Try: =(Nz([fieldname1],0) + Nz([fieldname2],0) +... Nz ([fieldname21],0))/ABS(IsNull(Field1) + IsNull(Field2) + ...) Chris Nebinger -----Original Message----- The problem is that, when you attempt to add a NULL value to anything it returns NULL. There is a function that will change the NULL values to 0 and let your proceed. =(Nz([fieldname1],0) + Nz([fieldname2],0) +... Nz ([fieldname21],0))/21 -- Lynn Trapp MS Access MVP www.ltcomputerdesigns.com Access Security: www.ltcomputerdesigns.com/Security.htm "Júlia" wrote in message news:92EBEBA5-DD2A-44A8-8C69- ... I am Portuguese woman and I am a novice using MS Access databases. I am now in charge of analyzing the data gathered from a Questionnaire distributed to 235 persons in my company and I decided to create a database using the Access. The Questionnaire has 21 questions and each question is answered with a number that goes from 1 (Entirely Unsatisfied) to 5 (Entirely Satisfied). This is a simple database, where I used a Table, a Form, some simple queries and simple reports. It was quite easy to make queries to give me the averages of each question (by using the wizard) but it started to become difficult to find out how to get the average of some average values. Even though I made it and it works, but maybe not the better way. This is an example of how I made it in the Query: =avg([fieldname]+ [fieldname])/2. This expression works even if not all the 21 fields have a value. I mean, if I leave a field blank, the Query gives me the average of that same field for all the existing Questionnaires. Anyway, and hoping that you understand my English and my explanation, I wanted to use an expression in my Form to give me the global average value for each Questionnaire as I am introducing the values. This is how I made it in the text box: =([fieldname1]+ [fieldname2]+... [fieldname21])/21 (number of questions in the questionnaire). It worked up to the moment where I started to have some Questionnaires with some fields left blank... The Queries do not mind to find some fields blank but the expression I used in the Form seems to not work when it finds a field blank.. I also tried to make a query to give me the average value for each questionnaire (from question1 to question21) but it didn't work, anyway. Is there a way for you to help me, in case you did understand what I wrote? I sincerely hope so because I can't succeed by simple reading the MS Access Help... . . . |
#10
|
|||
|
|||
On Mon, 13 Sep 2004 10:49:02 -0700, Jlia
wrote: The expression you entered contains invalid syntax. You omitted an operand or operator, you entered invalid character or comma, or you entered text without surrounding it in quotation marks. Please copy and paste the entire expression to a message in the newsgroup. John W. Vinson[MVP] (no longer chatting for now) |
|
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Comparing averages | Mark Houghton | New Users | 12 | August 4th, 2004 06:38 AM |
Meaningful averages | Daniel | Worksheet Functions | 1 | March 5th, 2004 03:32 AM |
Dates and Averages | Bill | Worksheet Functions | 0 | October 6th, 2003 11:28 PM |
Extracting Averages | Bill | Worksheet Functions | 1 | October 6th, 2003 05:30 PM |