Results 1 to 4 of 4

Thread: Find -$####.#### or $####.###

  1. #1

    Thread Starter
    Fanatic Member mateo107's Avatar
    Join Date
    Jan 2005
    Posts
    547

    Find -$####.#### or $####.###

    I have a terrible excel worksheet I'm working on. In a single column, it has a description and also an associated charge, either a debit or deposit.

    The debits are listed as:
    Description -$#.##

    Deposits are listed as:
    Description $#.##

    Is there any easy way to copy the cells correctly to another column in one formula, that would also keep the proper negative or positive value?

    I can't do a simple RIGHT command, cause the # of characters for the $$ amount varies.
    And since the - sign appears before the $ I can't seem to use that either.

    The default find and replace in Excel isn't working either - no matter if I choose to search values or formulas (even though the format of the cells is set to text and it's a value and not a formula).

    Anyone have any ideas?

    Ideally I need the resultant column to show
    ABC -$10.00
    CCC -$124.23
    DDD $12.00

    etc.


    -Matthew-

  2. #2
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Find -$####.#### or $####.###

    Ideally I need the resultant column to show
    i am not clear if you want all the values in a separate column from the description, the above comment indicates the description would still be in the same column

    Is there any easy way to copy the cells correctly to another column in one formula
    this formula will put all the values into a second column separate from the description, but the original column would still remain the unchanged
    =MID(A1,FIND(" ",A1),LEN(A1)-FIND(" ",A1) +1), change cell reference to suit and drag down the column

    if you want to remove the value from the description in the original column, i guess it would require VBA
    Code:
    for each cel in range("a:a")
        if isempty(cel) then exit for    'stop on blank row
        tmp = split(cel, " ")
        cel = tmp(0)
        cel.offset(, 5) = tmp(UBound(tmp))
    next
    again some changes may be required, depending on the worksheet

    in the case of the formula the content of the cell is a string, whereas the vba actually puts a numeric value in the cell
    all depends what you want
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  3. #3
    PowerPoster Zvoni's Avatar
    Join Date
    Sep 2012
    Location
    To the moon and then left
    Posts
    4,419

    Re: Find -$####.#### or $####.###

    I'd first ask, if the content of those cells are REALLY strings (as the OP implies) or just "normal" numbers (Doubles from the looks of it), formatted to show up as currency values
    Last edited by Zvoni; Tomorrow at 31:69 PM.
    ----------------------------------------------------------------------------------------

    One System to rule them all, One Code to find them,
    One IDE to bring them all, and to the Framework bind them,
    in the Land of Redmond, where the Windows lie
    ---------------------------------------------------------------------------------
    People call me crazy because i'm jumping out of perfectly fine airplanes.
    ---------------------------------------------------------------------------------
    Code is like a joke: If you have to explain it, it's bad

  4. #4
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Find -$####.#### or $####.###

    @ Zvoni, as he says it is a single column containing description first and value i would assume they would have to be a string, but without clarification (like a sample workbook) i can only guess

    i assumed (likely incorrectly) that the data is from some other text source, either file or live feed
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width