Forum Discussion
renee_crozier
Nov 27, 2024Brass Contributor
Reorder Cell Data Using Power Query
I'm trying to take a list of items, reorder the data in a single cell, and then alphabetize the column. Alphabetizing the column is easy but reordering the data in a cell is tripping me up. I know I ...
peiyezhu
Nov 28, 2024Bronze Contributor
online SQL:
cli_add_php~~
$GLOBALS["f"]=function($s){
$ar=preg_split('/,\s/',$s,-1,PREG_SPLIT_NO_EMPTY);
//print_r($ar);
sort($ar);
$s=implode(',',$ar);
return $s;
};
~;
create temp table aa as
select *,udf_run_php(f01,'$a=$GLOBALS["f"]($origValues);') output,length(f01) o from Sheet1;
create temp table bb as
select output,rank() over (partition by substr(output,1,1) order by o,output) from aa ;
select output from bb;