# Data Manipulation

Excel, as a product, always remains under active development from Microsoft. With new releases, new features are brought in whereas old ones are discarded. Due to this there might be changes to the solutions mentioned below depending on the version that you are using.
SUM of digits
Can you write a formula to generate the SUM of all digits in a cell? To use when you are sure that there are only digits in the column:
`=SUMPRODUCT(--MID(B2,ROW(INDIRECT("1:"&LEN(B2))),1))`
But if there are other characters too use this:
`=SUMPRODUCT((LEN(B3)-LEN(SUBSTITUTE(B3,ROW(1:9),"")))*ROW(1:9))`
DISTINCT & Duplicates
This is a 3-part question:
• Given a table of data how do you tell if it has duplicates?
• Create a table with distinct values from this
• Can you do a conditional duplicate check on this table?
| Region | ID |
|--------|----|
| A | 1 |
| B | 2 |
| C | 3 |
| C | 4 |
| B | 3 |
| C | 4 | `= COUNTIF(\$B\$2:\$B\$7)` Rows with value > 1 has duplicates
`=UNIQUE(A2:B7)`
`=IF(B2>3,COUNTIF(\$B\$2:\$B\$7,B4),0)`