We're aware that some users are experiencing technical issues which the team are working to resolve. See the Community Noticeboard for more info. Thank you for your patience.
📨 Have you signed up to the Forum's new Email Digest yet? Get a selection of trending threads sent straight to your inbox daily, weekly or monthly!

I need advice re: excel formula please

Options
So what I want to do is this..........


If cell A1 has the word expense in it and if cell B1 shows a negative figure in it , say -112, I want the minus sign removed from cell B1 to just then show 112


Any help will be appreciated :)
«13

Comments

  • unforeseen
    unforeseen Posts: 7,380 Forumite
    Part of the Furniture 1,000 Posts Photogenic Name Dropper
    In plain english
    If A1 contains expense then B1 = ABS(B1)

    You don't need to test for negative values if the A1 condition is met
  • that
    that Posts: 1,532 Forumite
    just multiply it by -1
  • unforeseen
    unforeseen Posts: 7,380 Forumite
    Part of the Furniture 1,000 Posts Photogenic Name Dropper
    I think it may need some VBA code actually. I haven't touched VBA for about 10 years
  • Cornucopia
    Cornucopia Posts: 16,470 Forumite
    Part of the Furniture 10,000 Posts Name Dropper Photogenic
    edited 19 January 2019 at 10:35PM
    If the result is to go into a third cell, say, C1, then it's easy...

    =IF(LOWER(A1)="expenses",ABS(B1),B1)

    I'd add LOWER so that any case matches.
  • victor2
    victor2 Posts: 8,095 Ambassador
    Part of the Furniture 1,000 Posts Name Dropper
    edited 19 January 2019 at 10:41PM
    So what I want to do is this..........


    If cell A1 has the word expense in it and if cell B1 shows a negative figure in it , say -112, I want the minus sign removed from cell B1 to just then show 112


    Any help will be appreciated :)
    You can do it with conditional formatting on cell B1, along the lines of:
    Format values where this formula is true: =FIND("expense",A1)
    Format: 0.00;0.00


    Note this only alters the way the negative number is displayed, if you refer to the cell with another formula, its true value (if negative) will be used.
    Also, it is case sensitive, you'd need a slightly more complex condition to get round that.


    Why are expense items entered as negative anyway, or are they looked up from elsewhere?
    If so, conditional formatting may not be the answer.

    I’m a Forum Ambassador and I support the Forum Team on the In My Home MoneySaving, Energy and Techie Stuff boards. If you need any help on these boards, do let me know. Please note that Ambassadors are not moderators. Any posts you spot in breach of the Forum Rules should be reported via the report button, or by emailing forumteam@moneysavingexpert.com. 

    All views are my own and not the official line of MoneySavingExpert.

  • Cornucopia
    Cornucopia Posts: 16,470 Forumite
    Part of the Furniture 10,000 Posts Name Dropper Photogenic
    Even with such a simple requirement, more info is required...
  • unforeseen
    unforeseen Posts: 7,380 Forumite
    Part of the Furniture 1,000 Posts Photogenic Name Dropper
    Cornucopia wrote: »
    If the result is to go into a third cell, say, C1, then it's easy...

    =IF(LOWER(A1)="expenses",ABS(B1),B1)

    I'd add LOWER so that any case matches.
    That will fail if there is a rogue space or other character in the cell

    =IF(FIND("expenses",LOWER(A1))>0, ABS(B1),B1)
    Deals with there being more than the word expenses in A1
  • Cornucopia wrote: »
    Even with such a simple requirement, more info is required...
    Spot on Corn!


    The question needs expanding. In Excel thereare many ways to change cell b1depending on the contents of cell a1 but the best solution will be subject to the need/reason xuch as:


    Do you wish to change just what is diplayed?
    Do you use cell b1 in other calculations i.e. The actual value needs changing?
    Is it just a one off cell change or will the test need repeating after a cell change/worksheet open/by user intervention?
    Is the change for a single cell based upon that corresponding single cell or multiples of one or the other or both i.e. ranges of cells contiguous or otherwise.


    I guess many of us like Corn. believe there is more to it than the outlined need otherwise you could just read cell a1 and change b1 manually!



    It would help if you could add more to your original post as to what and why on how it will be used
  • victor2
    victor2 Posts: 8,095 Ambassador
    Part of the Furniture 1,000 Posts Name Dropper
    longforgotten hasn't been back to look at the replies thus far anyway...;)

    I’m a Forum Ambassador and I support the Forum Team on the In My Home MoneySaving, Energy and Techie Stuff boards. If you need any help on these boards, do let me know. Please note that Ambassadors are not moderators. Any posts you spot in breach of the Forum Rules should be reported via the report button, or by emailing forumteam@moneysavingexpert.com. 

    All views are my own and not the official line of MoneySavingExpert.

  • unforeseen
    unforeseen Posts: 7,380 Forumite
    Part of the Furniture 1,000 Posts Photogenic Name Dropper
    victor2 wrote: »
    longforgotten hasn't been back to look at the replies thus far anyway...;)

    They may live up to their username.
This discussion has been closed.
Meet your Ambassadors

🚀 Getting Started

Hi new member!

Our Getting Started Guide will help you get the most out of the Forum

Categories

  • All Categories
  • 350.7K Banking & Borrowing
  • 253K Reduce Debt & Boost Income
  • 453.4K Spending & Discounts
  • 243.7K Work, Benefits & Business
  • 598.5K Mortgages, Homes & Bills
  • 176.8K Life & Family
  • 256.9K Travel & Transport
  • 1.5M Hobbies & Leisure
  • 16.1K Discuss & Feedback
  • 37.6K Read-Only Boards

Is this how you want to be seen?

We see you are using a default avatar. It takes only a few seconds to pick a picture.