I'm absolutely strugling here with this and I've been at it for more than a few hours now. Unfortunately I cannot use VBA, so have to stick to formulas!
I have cell A1 that needs to have only the numbers counted. The numbers are separated by by commas. So, let's say we have 1, 4, 5, 6. I'd like A2 to show "4". That's not a problem, I did:
=LEN(A1)-LEN(SUBSTITUTE(A1,",",""))+1-IF(A1=0,"1", "0")
But I'm also trying to make this more reliable, so that if people make mistakes and enter, say, double commas, or letters, that those are not counted. I have no idea, then, how to count just the numbers and nothing else. So, if someone entered: 1, 2,,3, 4 - they would get a result of 5.
I did come across a formula which confused the heck out of me, but gave me a glimmer of hope:
=SUMPRODUCT(MID(0&H9,LARGE(INDEX(ISNUMBER(--MID(A1,ROW(INDIRECT("1:"&LEN($A$1))),1))*
ROW(INDIRECT("1:"&LEN($A$1))),0),ROW(INDIRECT("1:"&LEN($A$1))))+1,1)*10^ROW(INDIRECT("1:"&LEN($A$1)))/10)
but that just displays the numbers, one next to the other. If I could only count that output...
I'd greatly appreciate any help!!
Thanks!!!!
I have cell A1 that needs to have only the numbers counted. The numbers are separated by by commas. So, let's say we have 1, 4, 5, 6. I'd like A2 to show "4". That's not a problem, I did:
=LEN(A1)-LEN(SUBSTITUTE(A1,",",""))+1-IF(A1=0,"1", "0")
But I'm also trying to make this more reliable, so that if people make mistakes and enter, say, double commas, or letters, that those are not counted. I have no idea, then, how to count just the numbers and nothing else. So, if someone entered: 1, 2,,3, 4 - they would get a result of 5.
I did come across a formula which confused the heck out of me, but gave me a glimmer of hope:
=SUMPRODUCT(MID(0&H9,LARGE(INDEX(ISNUMBER(--MID(A1,ROW(INDIRECT("1:"&LEN($A$1))),1))*
ROW(INDIRECT("1:"&LEN($A$1))),0),ROW(INDIRECT("1:"&LEN($A$1))))+1,1)*10^ROW(INDIRECT("1:"&LEN($A$1)))/10)
but that just displays the numbers, one next to the other. If I could only count that output...
I'd greatly appreciate any help!!
Thanks!!!!
Last edited: