CHOOSECOLS Function + Format Data

zero269

Board Regular
Joined
Jan 16, 2023
Messages
228
Office Version
  1. 365
Platform
  1. Windows
Hello,

I'm wondering if it's possible to format data for any of the column data being returned using the CHOOSECOLS Function?

Right now I've got a work in progress using something cobbled together with a portion of code provided by Fluff which I found here as it relates to LAMBA and TEXTJOIN.

Although I'm currently using TEXT(Points,"0.0"),Level,TEXT(Words,"#,###") in another scenario to format the numbers, I can't figure out how to format the output for any of the given columns of data that are being joined when using the formula in my sample data below.
VBA Testing.xlsm
AB
1Test Date:11-May
2
3Quiz | F/NF | Title | Points | Level | Words
4122822 | F | Mysterious Island (Saddleback) | 1 | 3.5 | 6146
5186904 | NF | Pilgrims' Voyage to America | 0.5 | 3.7 | 1918
6
7Desired Output with formatted POINTS and WORDS:
8122822 | F | Mysterious Island (Saddleback) | 1.0 | 3.5 | 6,146
9186904 | NF | Pilgrims' Voyage to America | 0.5 | 3.7 | 1,918
10
11Desired Output with a TAB to keep TITLES aligned:
12122822 | F | Mysterious Island (Saddleback) | 1.0 | 3.5 | 6,146
13186904 | NF | Pilgrims' Voyage to America | 0.5 | 3.7 | 1,918
Format
Cell Formulas
RangeFormula
A4:A5A4=BYROW(SORT(FILTER(CHOOSECOLS(t_Students,1,3,2,4,5,6), ISNUMBER(SEARCH($B$1,t_Students[Test Date])),"No Quiz"),6,-1), LAMBDA(br,TEXTJOIN(" | ",TRUE,br)))
Dynamic array formulas.

Regarding the use of TAB in a formula is likely a separate post. I've tried using CHAR(9) as the delimiter to no avail in various scenarios: TEXTJOIN, CONCAT and just using the ampersand (&).

Any help with better understanding how to handle the output of column data when using CHOOSECOLS would be greatly appreciated.

Thanks…
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
I get the impression that CHAR(9) (Tab) cannot be used as a delimeter when joining cells using TEXTJOIN, CONCAT, etc.

However, once I can figure out how to format the data being returned from the CHOOSECOLS array, I'm thinking the following may be my best bet as it relates to the formatting.

In the sample data below, I'm using IF to check if the value in F/NF is "F", and if so, then pad it with three spaces, else return 'NF'. This will keep the TITLEs alinged for greater readability.
Excel Formula:
IF(E3="F","F   ",E3)
I'm also able to format both POINTS and LEVEL as a RANGE using:
Excel Formula:
TEXT(G3:H3,"0.0")
Any advice on how to best isolate the data from CHOOSECOLS to format it before joining it into a single cell would be greatly appreciated...
VBA Testing.xlsm
ABCDEFGH
1SAMPLE DATATEXTJOIN + FORMAT
2QuizF/NFTitlePointsLevelWordsQuiz | F/NF | Title | Points | Level | Words
3122822FMysterious Island (Saddleback)13.56146122822 | F | Mysterious Island (Saddleback) | 1.0 | 3.5 | 6,146
4186904NFPilgrims' Voyage to America0.53.71918186904 | NF | Pilgrims' Voyage to America | 0.5 | 3.7 | 1,918
Tab_Delim
Cell Formulas
RangeFormula
H2:H4H2=TEXTJOIN(" | ",TRUE,A2,IF(B2="F","F ",B2),C2,TEXT(D2:E2,"0.0"),TEXT(F2,"#,###"))
 
Upvote 0

Forum statistics

Threads
1,216,116
Messages
6,128,933
Members
449,480
Latest member
yesitisasport

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