+ Reply to Thread
Results 1 to 6 of 6

If cell A1 contains number, then divide A1 by B1

  1. #1
    Registered User
    Join Date
    03-20-2014
    Location
    London, England
    MS-Off Ver
    Office 365
    Posts
    13

    If cell A1 contains number, then divide A1 by B1

    Hi there.

    I'm putting together a rough worksheet to track investments and dividend payments and would like a basic formula to work out the purchase (or sale) price of a particular stock based off number of shares purchased and total value paid. It seems like a basic thing, but I want to be able to see at a glance in the spreadsheet and potentially add a graph and average purchase price at a later point.

    In the attached spreadsheet, I want cell H8 to look and see whether cell F8 has a value in it, and if it does, then to divide F8 by D8.

    I.e. 1800/50 = 36

    I would then do the same for cell I8 by checking cell G8 and, if there's a value, multiplying it by E8.

    Am I making sense? Is this really too easy, but I'm still missing it?

    Thanks in advance.
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,570

    Re: If cell A1 contains number, then divide A1 by B1

    Just translate your sentence to an Excel formula
    ...if F8 has a value in it then to divide D8 (else zero)
    Please Login or Register  to view this content.
    Ben Van Johnson

  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,083

    Re: If cell A1 contains number, then divide A1 by B1

    Basic approach:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  4. #4
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,401

    Re: If cell A1 contains number, then divide A1 by B1

    One more to try...

    =IF(OR(F8="",D8=""),"",F8/D8)

  5. #5
    Registered User
    Join Date
    03-20-2014
    Location
    London, England
    MS-Off Ver
    Office 365
    Posts
    13

    Re: If cell A1 contains number, then divide A1 by B1

    See, so easy. I don't know why I didn't think of either of those solutions.

    Many thanks to all.

    M

  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,083

    Re: If cell A1 contains number, then divide A1 by B1

    You're welcome.


    If you are satisfied with the solution(s) provided, please mark your thread as Solved.


    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save


    You may also want to consider thanking those people who helped you by clicking on the little star at the bottom left of their reply to your question.

+ 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. Divide number in one cell between columns
    By ZVB1974 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-01-2019, 09:13 AM
  2. [SOLVED] Divide cell value by number less than one causes #DIV/0! error HELP
    By CactusCat in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-08-2019, 01:54 AM
  3. Help to divide a number from a variable cell
    By maym in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-03-2017, 05:32 AM
  4. Divide a number with cell containing txt and formula
    By adler in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 03-19-2015, 02:07 AM
  5. [SOLVED] Divide cell by X if number is greater...
    By JackBauer in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 03-10-2014, 07:03 AM
  6. Divide Number from data in Cell's?
    By termal in forum Excel General
    Replies: 2
    Last Post: 07-08-2009, 04:21 PM
  7. Divide number and add remainder in another cell
    By rhon101 in forum Excel General
    Replies: 4
    Last Post: 11-29-2005, 10:10 PM

Tags for this Thread

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