I have a series of numbers in column A.
I want to get the digit sums in column B in a single ArrayFormula (if possible).
1) REGEXEXTRACT(A1&"",REPT("(.)",LEN(A1))))
// returns a horizontal text array eg: 123 => 1|2|3
2) ARRAYFORMULA(VALUE(REGEXEXTRACT(A1&"",REPT("(.)",LEN(A1)))))
// returns the horizontal text array as a number array
3) SUM(ARRAYFORMULA(VALUE(REGEXEXTRACT(A1&"",REPT("(.)",LEN(A1))))))
// returns the digit sum of value in column A
Thank you.
EDIT: sample spreadsheet - currently, the formula is copied manually in column B - looking for a single ArrayFormula to do this.
Assuming the maximum number of digits per cell =7,
=ARRAYFORMULA(MMULT(SPLIT(REGEXREPLACE(TEXT(A1:A2,REPT("0",7)),"\B","🈂"),"🈂"),ROW(A1:A7)^0))
7
to the maximum number of digits per cell\B
with a arbitrary char1
matrix to give the desired result.