MEUserII
Board Regular
- Joined
- Oct 27, 2017
- Messages
- 91
- Office Version
- 365
- 2021
- 2019
- 2016
- 2013
- Platform
- Windows
I am looking to figure out in Excel 2016 how to write a formula that will sort a subset of values in consecutive position within a larger array with constant values (zeros), but keep those zeros in their same positions thus keeping the number of values in the array the same?
Moreover, an actual example would be the following:
[TABLE="class: grid, width: 100"]
<tbody>[TR]
[TD]R/C
[/TD]
[TD="align: center"]A
[/TD]
[TD="align: center"]B
[/TD]
[TD="align: center"]C
[/TD]
[TD="align: center"]D
[/TD]
[TD="align: center"]E
[/TD]
[/TR]
[TR]
[TD="align: center"]1
[/TD]
[TD]{0,0,0,44,31,25,53,12,0,0,0,0}
[/TD]
[TD]=>
[/TD]
[TD]{0,0,0,12,25,31,44,53,0,0,0,0}
[/TD]
[TD]
[/TD]
[TD]
[/TD]
[/TR]
[TR]
[TD="align: center"]2
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: center"]3
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: center"]4
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: center"]5
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
Where A1={0,0,0,44,31,25,53,12,0,0,0,0}
What Excel formula would I use that would take the array in A1 and sort only the non-zero values (44,31,25,53,12) and keep the same number of zeros in their same positions, so as to return the desired result that I've entered in to C1?
Where C1={0,0,0,12,25,31,44,53,0,0,0,0}
Moreover, an actual example would be the following:
[TABLE="class: grid, width: 100"]
<tbody>[TR]
[TD]R/C
[/TD]
[TD="align: center"]A
[/TD]
[TD="align: center"]B
[/TD]
[TD="align: center"]C
[/TD]
[TD="align: center"]D
[/TD]
[TD="align: center"]E
[/TD]
[/TR]
[TR]
[TD="align: center"]1
[/TD]
[TD]{0,0,0,44,31,25,53,12,0,0,0,0}
[/TD]
[TD]=>
[/TD]
[TD]{0,0,0,12,25,31,44,53,0,0,0,0}
[/TD]
[TD]
[/TD]
[TD]
[/TD]
[/TR]
[TR]
[TD="align: center"]2
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: center"]3
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: center"]4
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: center"]5
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
Where A1={0,0,0,44,31,25,53,12,0,0,0,0}
What Excel formula would I use that would take the array in A1 and sort only the non-zero values (44,31,25,53,12) and keep the same number of zeros in their same positions, so as to return the desired result that I've entered in to C1?
Where C1={0,0,0,12,25,31,44,53,0,0,0,0}