+ Reply to Thread
Results 1 to 4 of 4

Formula conditional on contents of cell

  1. #1
    Registered User
    Join Date
    06-25-2015
    Location
    UK
    MS-Off Ver
    2010
    Posts
    15

    Formula conditional on contents of cell

    I have a simple calculation that I want completed BUT only when there is a number entered in to a certain cell.

    Simply I want =A2-A1 and the answer to show in cell A27, BUT only when cell A2 has something in it. If cell A2 is blank I don't want to have the calculation happen (or to produce a non numerical answer like n/a or null or something). I'm sure I have done this, or something similar, before but I've just hit a brick wall trying to get it to work! If anyone has any suggestions please help.

  2. #2
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: Formula conditional on contents of cell

    Maybe -

    =IF(A2<>"",A2-A1,"")

    But just a note, even if A2 is blank, and you are trying =A2-A1, it should not return an error.. It will calculate the blank as if it were 0
    Last edited by NeedForExcel; 07-06-2015 at 07:54 AM.
    Cheers!
    Deep Dave

  3. #3
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: Formula conditional on contents of cell

    =IF(A2<>"",A2-A1,"")
    or
    =IF(ISNUMBER(A2),A2-A1,"")
    Samba

    Say thanks to those who have helped you by clicking Add Reputation star.

  4. #4
    Registered User
    Join Date
    06-25-2015
    Location
    UK
    MS-Off Ver
    2010
    Posts
    15

    Re: Formula conditional on contents of cell

    =IF(ISNUMBER(A2),A2-A1,"")

    Worked perfectly!!! Thanks so much.

+ 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. Conditional formatting based on contents of another cell
    By Kevska in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 06-29-2015, 09:54 PM
  2. Conditional statement w/ copied cell contents
    By mutewitness9 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-14-2014, 12:08 PM
  3. [SOLVED] Conditional copy formula contents from one cell into another cell
    By fozzie in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 09-04-2012, 03:35 AM
  4. Conditional Move Cell Contents
    By jordan2322 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-17-2012, 12:35 PM
  5. [SOLVED] Conditional Formatting based on contents in another cell
    By flisters in forum Excel General
    Replies: 3
    Last Post: 03-22-2012, 07:04 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