Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10
Default Need to average division of two columns based on criteria

I have two sheets
Sheet 1 contains Catagories with respective beginning and ending values (Ie
Category A begins at 10 and ends at 20) There are about 75 categories all
with different beginning and ending values. There is no overlapping, so no
category can contain the same number.
Category CPT Range Start End
E&M Office Visits 99201 - 99215 99201 99215
E&M Hospital Services 99217 - 99239 99217 99239
E&M Consultations 99241 - 99255 99241 99255
E&M Neonatal 99295 - 99300 99295 99300

Sheet 2 contains all the numbers that correspond to the 75 categories (Ie 10
- 10000) in column A. Column B contains an "amount" for each number and
column C contains another "amount" for each number.

Column A Column B Column C
99201 35 40
99202 40 45
99203 45 50
99204 50 55

What i am trying to do is return the average of the range for a category
when dividing one amount by another amount. So for Category E&M Office
Visits i would want to return the average of column c/column b for all codes
within the range (99201-99215). Can this be done without using a macro??

For further information (Column A in Sheet 2 Contains 16,0000 numbers
ranging from 10000 to 99999)
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 173
Default Need to average division of two columns based on criteria

If I understand you correctly then the answer is yes. You can do this using
an array expression. For the sake of simplicity in providing an expression,
I'll assume that both tables are on the same sheet (but this should work for
separate sheets as well). Say that your first table is at A1:C4 and your
second table is at G1:I4. For the first Category (in row 1), you can get the
average of the division of the numbers in columns H and I for items in G that
fall in the range between B and C using:

=SUM(($G$1:$G$4=B1)*($G$1:$G$4<=C1)*($I$1:$I$4))/SUM(($G$1:$G$4=B1)*($G$1:$G$4<=C1)*($H$1:$H$4))

ONCE YOU TYPE in the expression, instead of simply hitting Enter, hit
Ctrl-Shift-Enter. This will make the expression into an array expression
(and "{}"brackets will automatically be added to it).

You can then copy the expression down for each of the categories.

Hope this helps.

Will
"pblenis" wrote:

I have two sheets
Sheet 1 contains Catagories with respective beginning and ending values (Ie
Category A begins at 10 and ends at 20) There are about 75 categories all
with different beginning and ending values. There is no overlapping, so no
category can contain the same number.
Category CPT Range Start End
E&M Office Visits 99201 - 99215 99201 99215
E&M Hospital Services 99217 - 99239 99217 99239
E&M Consultations 99241 - 99255 99241 99255
E&M Neonatal 99295 - 99300 99295 99300

Sheet 2 contains all the numbers that correspond to the 75 categories (Ie 10
- 10000) in column A. Column B contains an "amount" for each number and
column C contains another "amount" for each number.

Column A Column B Column C
99201 35 40
99202 40 45
99203 45 50
99204 50 55

What i am trying to do is return the average of the range for a category
when dividing one amount by another amount. So for Category E&M Office
Visits i would want to return the average of column c/column b for all codes
within the range (99201-99215). Can this be done without using a macro??

For further information (Column A in Sheet 2 Contains 16,0000 numbers
ranging from 10000 to 99999)

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10
Default Need to average division of two columns based on criteria

That seems to do the trick, thank you.

"roadkill" wrote:

If I understand you correctly then the answer is yes. You can do this using
an array expression. For the sake of simplicity in providing an expression,
I'll assume that both tables are on the same sheet (but this should work for
separate sheets as well). Say that your first table is at A1:C4 and your
second table is at G1:I4. For the first Category (in row 1), you can get the
average of the division of the numbers in columns H and I for items in G that
fall in the range between B and C using:

=SUM(($G$1:$G$4=B1)*($G$1:$G$4<=C1)*($I$1:$I$4))/SUM(($G$1:$G$4=B1)*($G$1:$G$4<=C1)*($H$1:$H$4))

ONCE YOU TYPE in the expression, instead of simply hitting Enter, hit
Ctrl-Shift-Enter. This will make the expression into an array expression
(and "{}"brackets will automatically be added to it).

You can then copy the expression down for each of the categories.

Hope this helps.

Will
"pblenis" wrote:

I have two sheets
Sheet 1 contains Catagories with respective beginning and ending values (Ie
Category A begins at 10 and ends at 20) There are about 75 categories all
with different beginning and ending values. There is no overlapping, so no
category can contain the same number.
Category CPT Range Start End
E&M Office Visits 99201 - 99215 99201 99215
E&M Hospital Services 99217 - 99239 99217 99239
E&M Consultations 99241 - 99255 99241 99255
E&M Neonatal 99295 - 99300 99295 99300

Sheet 2 contains all the numbers that correspond to the 75 categories (Ie 10
- 10000) in column A. Column B contains an "amount" for each number and
column C contains another "amount" for each number.

Column A Column B Column C
99201 35 40
99202 40 45
99203 45 50
99204 50 55

What i am trying to do is return the average of the range for a category
when dividing one amount by another amount. So for Category E&M Office
Visits i would want to return the average of column c/column b for all codes
within the range (99201-99215). Can this be done without using a macro??

For further information (Column A in Sheet 2 Contains 16,0000 numbers
ranging from 10000 to 99999)

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10
Default Need to average division of two columns based on criteria

Now that i got the basic formula figured out, how do i tell it to ignore
errors??

"pblenis" wrote:

I have two sheets
Sheet 1 contains Catagories with respective beginning and ending values (Ie
Category A begins at 10 and ends at 20) There are about 75 categories all
with different beginning and ending values. There is no overlapping, so no
category can contain the same number.
Category CPT Range Start End
E&M Office Visits 99201 - 99215 99201 99215
E&M Hospital Services 99217 - 99239 99217 99239
E&M Consultations 99241 - 99255 99241 99255
E&M Neonatal 99295 - 99300 99295 99300

Sheet 2 contains all the numbers that correspond to the 75 categories (Ie 10
- 10000) in column A. Column B contains an "amount" for each number and
column C contains another "amount" for each number.

Column A Column B Column C
99201 35 40
99202 40 45
99203 45 50
99204 50 55

What i am trying to do is return the average of the range for a category
when dividing one amount by another amount. So for Category E&M Office
Visits i would want to return the average of column c/column b for all codes
within the range (99201-99215). Can this be done without using a macro??

For further information (Column A in Sheet 2 Contains 16,0000 numbers
ranging from 10000 to 99999)

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 173
Default Need to average division of two columns based on criteria

I assume the error you are getting is a divide by 0. There must be
categories that don't have non-zero data. You can eliminate this by adding a
check for 0 denominator values. The formula previously provided would become:

=IF(SUM(($G$1:$G$4=B1)*($G$1:$G$4<=C1)*($H$1:$H$4 ))=0,"put here whatever
you want the cell to read if there is an
error",SUM(($G$1:$G$4=B1)*($G$1:$G$4<=C1)*($I$1:$ I$4))/SUM(($G$1:$G$4=B1)*($G$1:$G$4<=C1)*($H$1:$H$4)))

Will


"pblenis" wrote:

Now that i got the basic formula figured out, how do i tell it to ignore
errors??

"pblenis" wrote:

I have two sheets
Sheet 1 contains Catagories with respective beginning and ending values (Ie
Category A begins at 10 and ends at 20) There are about 75 categories all
with different beginning and ending values. There is no overlapping, so no
category can contain the same number.
Category CPT Range Start End
E&M Office Visits 99201 - 99215 99201 99215
E&M Hospital Services 99217 - 99239 99217 99239
E&M Consultations 99241 - 99255 99241 99255
E&M Neonatal 99295 - 99300 99295 99300

Sheet 2 contains all the numbers that correspond to the 75 categories (Ie 10
- 10000) in column A. Column B contains an "amount" for each number and
column C contains another "amount" for each number.

Column A Column B Column C
99201 35 40
99202 40 45
99203 45 50
99204 50 55

What i am trying to do is return the average of the range for a category
when dividing one amount by another amount. So for Category E&M Office
Visits i would want to return the average of column c/column b for all codes
within the range (99201-99215). Can this be done without using a macro??

For further information (Column A in Sheet 2 Contains 16,0000 numbers
ranging from 10000 to 99999)



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
Average/Sumif based on several columns mslabbe Excel Worksheet Functions 3 February 4th 07 09:40 PM
Average/Sumif based on several columns mslabbe Excel Worksheet Functions 0 February 4th 07 05:49 PM
Calculate average based on date and other criteria Kycajun Excel Discussion (Misc queries) 3 July 14th 06 10:08 PM
Calculating an average based on 2 and 3 criteria craggergirl Excel Worksheet Functions 2 February 24th 06 02:37 PM
caluculate an average based on 2 criteria [email protected] Excel Discussion (Misc queries) 3 November 3rd 05 03:34 AM


All times are GMT +1. The time now is 12:03 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"