+ Reply to Thread
Results 1 to 6 of 6

If cell is < 0, do this, else do that

  1. #1
    Registered User
    Join Date
    12-03-2012
    Location
    Manalapan, NJ
    MS-Off Ver
    Excel 2007
    Posts
    20

    If cell is < 0, do this, else do that

    How can I get A7 to say something like =IF(B4<0, *(-1)), and include the rest of the formula? If it's greater than 0, don't change it. Also, how do I get G4 to be a positive number? Thanks.
    Attached Files Attached Files
    Last edited by FDibbins; 06-09-2016 at 01:58 AM.

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,917

    Re: IF Function

    Please take a moment to read the forum rules and then amend your thread title to something descriptive of your problem - not what you think the answer might be. (think google search terms?). Once you have done this please send me a PM and I will remove this request. (Also, include a link to your thread - copy from the address bar)

    Many members search our previous posts, and thread titles play a big part of the search. I doubt anybody would do a search based on your title?

    To change a Title on your post, click EDIT POST then Go Advanced and change your title, if 2 days have passed ask a moderator to do it for you.

    (note: this change is not optional )

    (you pretty much already have your answer with what you showed)
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,917

    Re: If cell is < 0, do this, else do that

    Not really sure what you are trying to calc here, or where you want the formula (G4?), but maybe something like this...

    =IF(B4<0, -your formula,your formula)

    to get a pos value, use =ABS(your formula)

  4. #4
    Registered User
    Join Date
    12-03-2012
    Location
    Manalapan, NJ
    MS-Off Ver
    Excel 2007
    Posts
    20

    Re: If cell is < 0, do this, else do that

    Here is the formula: =IF((B4<0), ((E4/B4)*100)+D3, (B4*E4)/100-D3). How can I get it to read "if any result is negative, multiply by (-1).
    If I try to put (-1) anywhere in the formula, it totally changes the result. Not sure if there's such thing as If within an If???

  5. #5
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: If cell is < 0, do this, else do that

    Just wrap the whole formula in the ABS function

    =ABS(IF(B4<0,E4/B4*100+D3,B4*E4/100-D3))
    Last edited by Jonmo1; 06-09-2016 at 10:08 PM.

  6. #6
    Registered User
    Join Date
    12-03-2012
    Location
    Manalapan, NJ
    MS-Off Ver
    Excel 2007
    Posts
    20

    Re: If cell is < 0, do this, else do that

    Thanks, that worked!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Calling function inside function. (aka nested function)
    By jakopak in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-02-2015, 05:58 AM
  2. VBA code for custom function that returns detail results of array function
    By onechipshot in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-10-2015, 06:30 PM
  3. Replies: 1
    Last Post: 06-10-2015, 12:56 PM
  4. Replies: 13
    Last Post: 04-08-2014, 05:46 AM
  5. Replies: 2
    Last Post: 01-15-2014, 11:40 PM
  6. index function error using match function to get data from a cell in an array
    By mabildgaard in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-17-2013, 02:21 AM
  7. Replies: 1
    Last Post: 03-21-2012, 11:22 AM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1