Condition for Torow function

pto160

Active Member
Joined
Feb 1, 2009
Messages
478
Office Version
  1. 365
Platform
  1. Windows
Is it possible to use conditions with the Torow function in conjunction with the choosecolumns function? In this example, the condition is order 300.

Book1
ABCDEFG
1AmountNameReceiptOrder
2100John Smitha300
3200Jane Joeb400
4200John Smithc300
5
6Order
7300#NAME?100b200c200
8
9What I like
10300a100c200
Sheet1
Cell Formulas
RangeFormula
B7B7=TOROW(CHOOSECOLS(A2:D4,3,1))
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
MrExcelPlayground18.xlsx
ABCDE
1AmountNameReceiptOrder
2100John Smitha300
3200Jane Joeb400
4200John Smithc300
5
6Order
7300a100c200
Sheet17
Cell Formulas
RangeFormula
B7:E7B7=TOROW(CHOOSECOLS(FILTER(A2:D4,D2:D4=A7),3,1))
Dynamic array formulas.
 
Upvote 0
Thank you. Absolutely brilliant. (y) In the example I have at work the receipt number is a number and the amount I'll format as a number correct to 2 decimal points.
Is there a way to separate each row with a blank cell?

Book1
ABCDEF
9What I like
10300a100c200
Sheet1
 
Upvote 0
I'm not sure what you mean by separate each row with a blank cell. It's outputting one row.
 
Upvote 0
Do you mean this?
MrExcelPlayground18.xlsx
ABCDEFG
1AmountNameReceiptOrder
2100John Smitha300
3200Jane Joeb400
4200John Smithc300
5
6Order
7300a100c200
Sheet17
Cell Formulas
RangeFormula
B7:G7B7=TOROW(EXPAND(CHOOSECOLS(FILTER(A2:D4,D2:D4=A7),3,1),ROWS(CHOOSECOLS(FILTER(A2:D4,D2:D4=A7),3,1)),3,""))
Dynamic array formulas.
 
Upvote 0
Thank you so much. (y) :) That is exactly what I was looking for. That is a very unique way of using the expand function.
I am just wondering about something. The ,3,"")) at the end of the function.
When would you need to change that number which is currently 3?
 
Upvote 0
Wouldn't this suffice?

23 07 01.xlsm
ABCDEFG
1AmountNameReceiptOrder
2100John Smitha300
3200Jane Joeb400
4200John Smithc300
5
6Order
7300a100c200
pto160
Cell Formulas
RangeFormula
B7:G7B7=TOROW(EXPAND(CHOOSECOLS(FILTER(A2:C4,D2:D4=A7),3,1),,3,""))
Dynamic array formulas.


When would you need to change that number which is currently 3?
If you wanted more than 3 columns in each 'block'. That is, if you wanted more than one blank column between each result. Example - to get 3 blanks between each result.

23 07 01.xlsm
ABCDEFGH
1AmountNameReceiptOrder
2100John Smitha300
3200Jane Joeb400
4200John Smithc300
5
6Order
7300a100c200
pto160
Cell Formulas
RangeFormula
B7:K7B7=TOROW(EXPAND(CHOOSECOLS(FILTER(A2:C4,D2:D4=A7),3,1),,5,""))
Dynamic array formulas.
 
Upvote 0

Peter_SSs, The formula works great. (y) :) . Thanks for explaining what the 3 at the end means. The expand function is becoming a really useful Excel function.​

Thanks for your help.
 
Upvote 0
You're welcome. Thanks for the follow-up. :)
 
Upvote 0
This is a great formula. I am just wondering if this could be applied to using a sumifs.
I am getting a #N/A for row 7 and 8.

Book1
ABCDEFG
1OrderVoucherAmt
2100100150
3100100175
4200100250
5100100310
6
7#NAME?1001125100250
8200#N/A#N/A#N/A#N/A#N/A#N/A
9
10What I like
11OrderVoucherAmountVoucherAmount
121001001125100310
13200100250
Sheet1
Cell Formulas
RangeFormula
A7A7=HSTACK(UNIQUE(A2:A5),TOROW(EXPAND(HSTACK(UNIQUE(B2:B5),SUMIFS(C2:C5,B2:B5,UNIQUE(B2:B5))),,3,"")))
 
Upvote 0

Forum statistics

Threads
1,215,069
Messages
6,122,959
Members
449,096
Latest member
Anshu121

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