#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 10
Default more sorting

I have a 20,000+ row table with twelve columns of monthly precipitation data.
Each column is a month of the year and each row is a yearly record. Missing
data is denoted by -9999. As you can see from a sample of the data below,
yearly records (rows) vary from being complete to having differing amounts of
missing data. It's easy enough to sort out those rows with complete data but
I would also like to sort out those rows with one, two, or three missing data
points (i.e. rows with one, two or three -9999 values). I'm after the sum of
each row (total rain per year) so I would then like to take the rows with
missing data do two things: first, average the other data fields in that row
and use that average value in place of the missing field and then sum the
row, and second, use the average of the adjacent data fields (months) to file
in the missing field (month) and then sum the row.

203 202 -9999 231 96 186 152 646 139 430 169 209
150 148 26 81 448 262 328 568 -9999 -9999 66 301
0 41 121 46 779 198 701 511 107 192 418 249
150 120 310 185 279 672 -9999 -9999 -9999 -9999 -9999 -9999
-9999 108 0 139 448 470 753 82 355 -9999 157 66

Thank you!
Ian
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,355
Default more sorting

Let's say your monthly data is in columns b-m .


For column 2 data
=SUMIF(B2:M2,"<-9999",B2:M2)
This is the sum of months without a -9999 value entered

TO count the number of times -9999 is entered in the row, use this
=COUNTIF(B2:M2,"=-9999")


Without using VBA, I'd probably use autofilter to find those rows that have
-9999 in them and add the average you want.

Come back if you have more questions.

"I. Miller" wrote:

I have a 20,000+ row table with twelve columns of monthly precipitation data.
Each column is a month of the year and each row is a yearly record. Missing
data is denoted by -9999. As you can see from a sample of the data below,
yearly records (rows) vary from being complete to having differing amounts of
missing data. It's easy enough to sort out those rows with complete data but
I would also like to sort out those rows with one, two, or three missing data
points (i.e. rows with one, two or three -9999 values). I'm after the sum of
each row (total rain per year) so I would then like to take the rows with
missing data do two things: first, average the other data fields in that row
and use that average value in place of the missing field and then sum the
row, and second, use the average of the adjacent data fields (months) to file
in the missing field (month) and then sum the row.

203 202 -9999 231 96 186 152 646 139 430 169 209
150 148 26 81 448 262 328 568 -9999 -9999 66 301
0 41 121 46 779 198 701 511 107 192 418 249
150 120 310 185 279 672 -9999 -9999 -9999 -9999 -9999 -9999
-9999 108 0 139 448 470 753 82 355 -9999 157 66

Thank you!
Ian

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 10
Default more sorting

Barb, thank you for the post--very helpful!

I still have one question:

Is there anyway to automate taking the average of the months on either side
of a missing field to fill in that field? Take the following example:

203 202 -9999 231 96 186 152 646 139 430 169 209

With your previous instructions I was able to automate using an average
based on the 11 other months and use that value to place into the missing
field. Now I'd like to use the average of "202" and "231" to fill in "-9999".


Also, I suspect this type of data string will cause problems because the two
missing fields are next to one another. Here I'd like to use the average of
"568" and "301" to fill in both missing fields.

150 148 26 81 448 262 328 568 -9999 -9999 66 301

Thanks!
Ian

in the missing field (month) and then sum the row.

"Barb Reinhardt" wrote:

Let's say your monthly data is in columns b-m .


For column 2 data
=SUMIF(B2:M2,"<-9999",B2:M2)
This is the sum of months without a -9999 value entered

TO count the number of times -9999 is entered in the row, use this
=COUNTIF(B2:M2,"=-9999")


Without using VBA, I'd probably use autofilter to find those rows that have
-9999 in them and add the average you want.

Come back if you have more questions.

"I. Miller" wrote:

I have a 20,000+ row table with twelve columns of monthly precipitation data.
Each column is a month of the year and each row is a yearly record. Missing
data is denoted by -9999. As you can see from a sample of the data below,
yearly records (rows) vary from being complete to having differing amounts of
missing data. It's easy enough to sort out those rows with complete data but
I would also like to sort out those rows with one, two, or three missing data
points (i.e. rows with one, two or three -9999 values). I'm after the sum of
each row (total rain per year) so I would then like to take the rows with
missing data do two things: first, average the other data fields in that row
and use that average value in place of the missing field and then sum the
row, and second, use the average of the adjacent data fields (months) to file
in the missing field (month) and then sum the row.

203 202 -9999 231 96 186 152 646 139 430 169 209
150 148 26 81 448 262 328 568 -9999 -9999 66 301
0 41 121 46 779 198 701 511 107 192 418 249
150 120 310 185 279 672 -9999 -9999 -9999 -9999 -9999 -9999
-9999 108 0 139 448 470 753 82 355 -9999 157 66

Thank you!
Ian

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,856
Default more sorting

You can't use a formula to change a value in another cell, so you
would have to use a bit of VBA (i.e. a macro) to do what you describe.

Pete

On Apr 6, 1:28 am, I. Miller
wrote:
Barb, thank you for the post--very helpful!

I still have one question:

Is there anyway to automate taking the average of the months on either side
of a missing field to fill in that field? Take the following example:

203 202 -9999 231 96 186 152 646 139 430 169 209

With your previous instructions I was able to automate using an average
based on the 11 other months and use that value to place into the missing
field. Now I'd like to use the average of "202" and "231" to fill in "-9999".

Also, I suspect this type of data string will cause problems because the two
missing fields are next to one another. Here I'd like to use the average of
"568" and "301" to fill in both missing fields.

150 148 26 81 448 262 328 568 -9999 -9999 66 301

Thanks!
Ian



in the missing field (month) and then sum the row.

"Barb Reinhardt" wrote:
Let's say your monthly data is in columns b-m .


For column 2 data
=SUMIF(B2:M2,"<-9999",B2:M2)
This is the sum of months without a -9999 value entered


TO count the number of times -9999 is entered in the row, use this
=COUNTIF(B2:M2,"=-9999")


Without using VBA, I'd probably use autofilter to find those rows that have
-9999 in them and add the average you want.


Come back if you have more questions.


"I. Miller" wrote:


I have a 20,000+ row table with twelve columns of monthly precipitation data.
Each column is a month of the year and each row is a yearly record. Missing
data is denoted by -9999. As you can see from a sample of the data below,
yearly records (rows) vary from being complete to having differing amounts of
missing data. It's easy enough to sort out those rows with complete data but
I would also like to sort out those rows with one, two, or three missing data
points (i.e. rows with one, two or three -9999 values). I'm after the sum of
each row (total rain per year) so I would then like to take the rows with
missing data do two things: first, average the other data fields in that row
and use that average value in place of the missing field and then sum the
row, and second, use the average of the adjacent data fields (months) to file
in the missing field (month) and then sum the row.


203 202 -9999 231 96 186 152 646 139 430 169 209
150 148 26 81 448 262 328 568 -9999 -9999 66 301
0 41 121 46 779 198 701 511 107 192 418 249
150 120 310 185 279 672 -9999 -9999 -9999 -9999 -9999 -9999
-9999 108 0 139 448 470 753 82 355 -9999 157 66


Thank you!
Ian- Hide quoted text -


- Show quoted text -



  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,856
Default more sorting

Anyway, why wouldn't you take 568 and 66 as the basis of the average
in your last example?

Pete

On Apr 6, 1:28 am, I. Miller
wrote:
Barb, thank you for the post--very helpful!

I still have one question:

Is there anyway to automate taking the average of the months on either side
of a missing field to fill in that field? Take the following example:

203 202 -9999 231 96 186 152 646 139 430 169 209

With your previous instructions I was able to automate using an average
based on the 11 other months and use that value to place into the missing
field. Now I'd like to use the average of "202" and "231" to fill in "-9999".

Also, I suspect this type of data string will cause problems because the two
missing fields are next to one another. Here I'd like to use the average of
"568" and "301" to fill in both missing fields.

150 148 26 81 448 262 328 568 -9999 -9999 66 301

Thanks!
Ian



in the missing field (month) and then sum the row.

"Barb Reinhardt" wrote:
Let's say your monthly data is in columns b-m .


For column 2 data
=SUMIF(B2:M2,"<-9999",B2:M2)
This is the sum of months without a -9999 value entered


TO count the number of times -9999 is entered in the row, use this
=COUNTIF(B2:M2,"=-9999")


Without using VBA, I'd probably use autofilter to find those rows that have
-9999 in them and add the average you want.


Come back if you have more questions.


"I. Miller" wrote:


I have a 20,000+ row table with twelve columns of monthly precipitation data.
Each column is a month of the year and each row is a yearly record. Missing
data is denoted by -9999. As you can see from a sample of the data below,
yearly records (rows) vary from being complete to having differing amounts of
missing data. It's easy enough to sort out those rows with complete data but
I would also like to sort out those rows with one, two, or three missing data
points (i.e. rows with one, two or three -9999 values). I'm after the sum of
each row (total rain per year) so I would then like to take the rows with
missing data do two things: first, average the other data fields in that row
and use that average value in place of the missing field and then sum the
row, and second, use the average of the adjacent data fields (months) to file
in the missing field (month) and then sum the row.


203 202 -9999 231 96 186 152 646 139 430 169 209
150 148 26 81 448 262 328 568 -9999 -9999 66 301
0 41 121 46 779 198 701 511 107 192 418 249
150 120 310 185 279 672 -9999 -9999 -9999 -9999 -9999 -9999
-9999 108 0 139 448 470 753 82 355 -9999 157 66


Thank you!
Ian- Hide quoted text -


- Show quoted text -



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with sorting jlynch Excel Worksheet Functions 3 September 18th 06 09:03 PM
Sorting: Sorting by the First Character dzuy Excel Discussion (Misc queries) 2 June 22nd 06 08:27 PM
Sorting Sorting Sorting Skydiver Excel Discussion (Misc queries) 4 June 3rd 06 02:42 PM
sorting faucetparts New Users to Excel 1 January 10th 06 02:41 PM
Sorting a1,a2,a10,a11 Arturo Excel Discussion (Misc queries) 1 March 11th 05 06:23 PM


All times are GMT +1. The time now is 02:49 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"