+ Reply to Thread
Results 1 to 5 of 5

if statement - usage of double if statements - solved

  1. #1
    Registered User
    Join Date
    07-21-2017
    Location
    ¿?
    MS-Off Ver
    2016
    Posts
    3

    if statement - usage of double if statements - solved

    d0dc24b12c52e514188d190bf1dada8a.png

    above is a scenario i want to create for keeping track of my investment profile

    so i created the spreadsheet format above.

    I want to implement some simple programming so its more automated, so that all i have to do is enter in the "End" amount at the end of each day, in order to determine whether its a gain or a loss from the starting value.

    how do i write the following formula/function?

    i was attempting the following as: =if(G24>G23) then input the number value of G24-G23 in the Gain cell, but if G24<G23 then G24-G23 value will be input automatically into the Loss cell

    how do I do that? Currently I can only do only one but not the other, as in I can only do gain but not gain and loss

    Much appreciated

    L
    Last edited by lydte; 07-22-2017 at 10:08 AM.

  2. #2
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: if statement

    If I understand correctly, Put this formula in G27...
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    1N73LL1G3NC3 15 7H3 4B1L17Y 70 4D4P7 70 CH4NG3 - 573PH3N H4WK1NG
    You don't have to add Rep if I have helped you out (but it would be nice), but please mark the thread as SOLVED if your issue is resolved.

    Tom

  3. #3
    Registered User
    Join Date
    07-21-2017
    Location
    ¿?
    MS-Off Ver
    2016
    Posts
    3

    Re: if statement

    what doe "" mean, and why do you do that?

    also if I do the formula you just did it messes up the gain cell and its just empty, how do i make the gain cell do a dash line "-" centered?

  4. #4
    Registered User
    Join Date
    07-21-2017
    Location
    ¿?
    MS-Off Ver
    2016
    Posts
    3

    Re: if statement

    nvm i was able to figure it out on my own this is what i corrected it to

    Gain cell: =IF(G24>G23,G24-G23,IF(G24<G23,"- "))
    Gain % cell: =IF(G24>G23,G25/G24,IF(G24<G23,"-"))

  5. #5
    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,929

    Re: if statement

    lydte welcome to the forum

    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 )
    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

+ 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. [SOLVED] i have an if then statement that works, how to make it work as a with or case statement
    By dmcgov in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 06-03-2016, 03:34 PM
  2. [SOLVED] If statement to select data - nested statement - assistance
    By petitesouris in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 06-29-2015, 09:55 PM
  3. compile error expected line number statement end statement
    By mattress58 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-18-2014, 10:12 AM
  4. VBA Compile Error : line number or label or statement or end of statement
    By excellearner121 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-04-2013, 06:41 PM
  5. Replies: 4
    Last Post: 06-01-2012, 10:05 AM
  6. Replies: 4
    Last Post: 05-16-2012, 05:33 PM
  7. [SOLVED] Utilize a Select Case Statement in Target Intersect Statement
    By max57 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-29-2009, 08:55 PM

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