Extract numeric entries from column B that match unique (first occurrence of) alphanumeric items in column A

StructuredWater

New Member
Joined
Jun 22, 2011
Messages
5
Dear Reader,

[Col A] [Col -] [Col -] [Col B]
URN DIEDLATER? Surg? LOS
ABC40643 FALSE TRUE 176
ABC40643 FALSE TRUE 176
ABC50503 FALSE TRUE 123
ABC64663 FALSE TRUE 62
ABC64663 FALSE TRUE 62
ABC52133 FALSE TRUE 124
ABC52133 FALSE TRUE 124
ABC55433 FALSE TRUE 132
ABC55433 FALSE TRUE 132
ABC34303 FALSE TRUE 78
ABC83573 FALSE TRUE 85
ABC83573 FALSE TRUE 85

The data shows length of stay (LOS) in surgical survivors (Surg? = TRUE, DIEDLATER? = FALSE) who had selected diagnoses. I want to generate quartiles from the LOS column for unique instances of the URN. Thus, for the data above I want to generate quartiles (1, 2 and 3) for the unique items 176, 123, 62, 124, 132, 78, 85. If two different URNs happen to have the same LOS, then the LOS is counted twice - it is the uniqueness of the URNs and not of the LOS's that determines if an LOS ends up (possibly more than once) in the final list to be passed to the QUARTILE function.
At the moment I am somewhat despondent. I can't figure out how to pull out the LOS's to pass to the QUARTILE function, and could do with some help.
Kind regards,
JohnM
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Further information: Excel 2003. The data shown above shows the filtered rows from my list meeting my criteria for patients who survived and had surgery. I was wanting to summarise the data just for those rows shown.

My list sheet has named ranges for the URN column (URNRange), the DIEDLATER? column (DeathsRange), the surgery column (SurgRange) and the length of stay column (LOSRange).

Thanks to Aladin Akyurek for some useful posts which got me started. My solution was:
=QUARTILE(IF((FREQUENCY(MATCH(INDIRECT(URNRange),INDIRECT(URNRange),0),MATCH(INDIRECT(URNRange),INDIRECT(URNRange),0))>0)*(OFFSET(INDIRECT(DeathsRange),0,0,ROWS(INDIRECT(DeathsRange))+1,1)=FALSE)*(OFFSET(INDIRECT(SurgRange),0,0,ROWS(INDIRECT(SurgRange))+1,1)=TRUE),OFFSET(INDIRECT(LOSRange),0,0,ROWS(INDIRECT(LOSRange))+1,1)),1)

This is probably a kludge but I had to work around the extra array element returned by FREQUENCY. I did this by increasing the size of the named ranges by one row, knowing that the extra 'empty' row of data would not return an LOS as it did not meet the selection criteria (eg being empty, it had no Surgery item so the surgery condition could not be true).

Is there an alternative? Could I have somehow resized the array returned by FREQUENCY to drop the unwanted final element so I would not need to resize the ranges?
 
Upvote 0

Forum statistics

Threads
1,224,544
Messages
6,179,430
Members
452,915
Latest member
hannnahheileen

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top