Extract numbers from text?

  • Hello!


    I have a range, let's say, A1:D9, in which are values like: "", sometext1234, 1234text, -1234, 1234, tetxt1234tetxt...
    I have this code which is working perfectly but, problem is in that MINUS1234. I just want to Sum these numbers. Code is working only if num is positive :(


  • Re: Extract numbers from text?


    Quote

    I just want to Sum these numbers. Code is working only if num is positive :-(


    From what I can see it isn't summing the numbers at all.


    What is it that you want to see, give an example of the result for a given input.

    Bruce :cool:

  • Re: Extract numbers from text?


    Yes, it does, it's summing. =Add_Numeric(A1:D9) Problem is in negative numbers, when it see minus(-) it goes with #VALUE! error, maybe thinks it's a text?

  • Re: Extract numbers from text?


    Quote

    Yes, it does, it's summing.


    Arguing isn't helpful, how about fulfilling my simple request, perhaps two minutes of your time to prepare a sample sheet.

    Bruce :cool:

  • Re: Extract numbers from text?


    I'm still not sure what you want.


    The argument you have for the function is range, a range can be one cell.


    I thought you wanted to add the numbers together, in other words the answer for sometext1234 would be 10 since that is 1+2+3+4, now with your example I'm not sure what you want and what you expect if you have a negative number.


    If you have sometext1234 in one cell and sometext-1234 in the other cell, what do you want 0 which is (1234) + (-1234) or 2468 which is 1234 + 1234 ignoring the negative in front of one of them, it's not clear?

    Bruce :cool:

  • Re: Extract numbers from text?


    No, I want strip cell to 1234, and then sum cells. Problem is with minus1234
    See my workbook, there is NO ERROR when using ones(1) number one...

  • Re: Extract numbers from text?


    You should post a workbook with an error because I can't re-create your error.


    I have a workbook attached with what I think you say is causing you problems and I don't see one.

    Files

    Bruce :cool:

  • Re: Extract numbers from text?


    Bruce, my apologize, now I have completely another problem/question. Maybe I should start a new thread. Code is fine everything is fine, but, now I realize that my problem is with a column not in array(A1:D9). Add_Numeric isn't working on A1:A9 it always returns values from whole array. I thought my problem is in negative numbers, now I realize that this NUMERIC code is only for array, I wish it could work on column also:(

  • Re: Extract numbers from text?


    Oh my God! Now again everything is NOT working! Sum of A1:A9 and A1:D9 is not correct;(




    Here is 23:47 i'm gone for zzZZZzzzz

    Files

  • Solved.