Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Probably an obvious answer, but I can't seem to figure it out. I have 2
columns of data, like this: Apples 7 Oranges 5 Pears 12 Bananas 2 I want to produce a 3rd column that sorts column A based on the value of Column B, thus the 3rd column would be: Bananas Oranges Apples Pears I know how to do that using "Data-Sort", but I want it to be done by formula so I don't have to manually do the sorting. Thanks, Pete |
#2
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
On Mon, 21 Sep 2009 13:58:01 -0700, PeteJ
wrote: Probably an obvious answer, but I can't seem to figure it out. I have 2 columns of data, like this: Apples 7 Oranges 5 Pears 12 Bananas 2 I want to produce a 3rd column that sorts column A based on the value of Column B, thus the 3rd column would be: Bananas Oranges Apples Pears I know how to do that using "Data-Sort", but I want it to be done by formula so I don't have to manually do the sorting. Thanks, Pete If the data in column B are all unique, try the following formula in cell C1: =INDEX(A$1:A$4,MATCH(SMALL(B$1:B$4,ROW()),B$1:B$4, 0)) Note: This is an array formula that has to be confirmed with CTRL+SHIFT+ENTER rather than just ENTER. Copy down as far as there are data in columns A and B. If the data in column B are not all unique, but there are no more than 1000 rows of data, all 1 or greater, try the following formula in cell C1: =INDEX(A$1:A$4,MATCH(SMALL(ROW()+1000*(B$1:B$4),RO W()),1000*(B$1:B$4)+ROW(),0)) Note: This is an array formula that has to be confirmed with CTRL+SHIFT+ENTER rather than just ENTER. Copy down as far as there are data in columns A and B. Hope this helps / Lars-Åke |
#3
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]() Thank you Lars-Ake, I tried both these formulas, and the both work exactly the same, slightly wrong. Does the data have to start in Row 1? My data is actually starting in Row 3, and both formulas are producing results that miss the first 2 data items. Does starting in Row 3 offset the "ROW()" function? Pete "Lars-Ã…ke Aspelin" wrote: On Mon, 21 Sep 2009 13:58:01 -0700, PeteJ wrote: Probably an obvious answer, but I can't seem to figure it out. I have 2 columns of data, like this: Apples 7 Oranges 5 Pears 12 Bananas 2 I want to produce a 3rd column that sorts column A based on the value of Column B, thus the 3rd column would be: Bananas Oranges Apples Pears I know how to do that using "Data-Sort", but I want it to be done by formula so I don't have to manually do the sorting. Thanks, Pete If the data in column B are all unique, try the following formula in cell C1: =INDEX(A$1:A$4,MATCH(SMALL(B$1:B$4,ROW()),B$1:B$4, 0)) Note: This is an array formula that has to be confirmed with CTRL+SHIFT+ENTER rather than just ENTER. Copy down as far as there are data in columns A and B. If the data in column B are not all unique, but there are no more than 1000 rows of data, all 1 or greater, try the following formula in cell C1: =INDEX(A$1:A$4,MATCH(SMALL(ROW()+1000*(B$1:B$4),RO W()),1000*(B$1:B$4)+ROW(),0)) Note: This is an array formula that has to be confirmed with CTRL+SHIFT+ENTER rather than just ENTER. Copy down as far as there are data in columns A and B. Hope this helps / Lars-Ã…ke |
#4
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Replace ROW() with ROW()-2 if your data starts in row 3.
Lars-Åke On Mon, 21 Sep 2009 18:04:01 -0700, PeteJ wrote: Thank you Lars-Ake, I tried both these formulas, and the both work exactly the same, slightly wrong. Does the data have to start in Row 1? My data is actually starting in Row 3, and both formulas are producing results that miss the first 2 data items. Does starting in Row 3 offset the "ROW()" function? Pete "Lars-Åke Aspelin" wrote: On Mon, 21 Sep 2009 13:58:01 -0700, PeteJ wrote: Probably an obvious answer, but I can't seem to figure it out. I have 2 columns of data, like this: Apples 7 Oranges 5 Pears 12 Bananas 2 I want to produce a 3rd column that sorts column A based on the value of Column B, thus the 3rd column would be: Bananas Oranges Apples Pears I know how to do that using "Data-Sort", but I want it to be done by formula so I don't have to manually do the sorting. Thanks, Pete If the data in column B are all unique, try the following formula in cell C1: =INDEX(A$1:A$4,MATCH(SMALL(B$1:B$4,ROW()),B$1:B$4, 0)) Note: This is an array formula that has to be confirmed with CTRL+SHIFT+ENTER rather than just ENTER. Copy down as far as there are data in columns A and B. If the data in column B are not all unique, but there are no more than 1000 rows of data, all 1 or greater, try the following formula in cell C1: =INDEX(A$1:A$4,MATCH(SMALL(ROW()+1000*(B$1:B$4),RO W()),1000*(B$1:B$4)+ROW(),0)) Note: This is an array formula that has to be confirmed with CTRL+SHIFT+ENTER rather than just ENTER. Copy down as far as there are data in columns A and B. Hope this helps / Lars-Åke |
#5
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]() |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Data sorting formula | Excel Worksheet Functions | |||
Sorting data derived from formula | Excel Worksheet Functions | |||
Formula won't adjust after sorting data | Excel Worksheet Functions | |||
sorting data, formula contance | New Users to Excel | |||
Sorting Data and Formula help... | Excel Discussion (Misc queries) |