+ Reply to Thread
Results 1 to 4 of 4

If C1 = "L" then subtract D1-B1 but If C1 = "S" then subtract B1-D1

  1. #1
    Registered User
    Join Date
    03-04-2020
    Location
    usa
    MS-Off Ver
    365
    Posts
    2

    If C1 = "L" then subtract D1-B1 but If C1 = "S" then subtract B1-D1

    I am trying to figure out how to subtract d1-B1 if cell is L but if cell is S then subtract B1-D1.
    I would also like to add if number is negative to be in Red.

    Thanks in advance!

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,813

    Re: If C1 = "L" then subtract D1-B1 but If C1 = "S" then subtract B1-D1

    Try this:

    =IF(C1="L",D1-B1,IF(C1="S",B1-D1,""))

    This returns a blank if C1 is neither "L" or "S".

    You can use conditional formatting to change the font to red if the cell value is negative (or you can use Custom Formatting).

    Hope this helps.

    Pete

  3. #3
    Registered User
    Join Date
    03-04-2020
    Location
    usa
    MS-Off Ver
    365
    Posts
    2

    Re: If C1 = "L" then subtract D1-B1 but If C1 = "S" then subtract B1-D1

    Thanks -I knew I was close!

  4. #4
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,813

    Re: If C1 = "L" then subtract D1-B1 but If C1 = "S" then subtract B1-D1

    If that takes care of your original question, please take a moment to select Thread Tools from the menu above and to the right of your first post in this thread, and mark the thread as SOLVED.

    Also, since you are relatively new to the forum, you might like to know that you can directly thank those who have helped you by clicking on the small "star" icon located in the lower left corner of a post that you have found to be helpful (not just in this thread - for any post that has helped you). This also adds to the reputation of the poster (the small green bars in the poster's profile).

    Pete

+ 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. Replies: 5
    Last Post: 02-05-2019, 12:03 AM
  2. [SOLVED] Column X-Ref list - Sheet1 Col A "pages", Col B:FL "Req" to Sheet2 ColA "req", ColB "page"
    By excel-card-pulled in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 04-07-2017, 09:30 AM
  3. [SOLVED] Excel 2007: How to Convert "5/2/2013" to "May" then subtract a Month so it's "Apr"
    By Golom in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 11-19-2013, 02:00 AM
  4. Replies: 4
    Last Post: 11-17-2013, 12:05 PM
  5. [SOLVED] How to USE """"" cells count """"" change font color
    By austin123456 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-09-2013, 06:14 AM
  6. Replies: 1
    Last Post: 01-27-2012, 11:25 PM
  7. Rearrange format with "TRIM" and "SUBTRACT" functions
    By Vittorio in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-08-2011, 07:37 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