+ Reply to Thread
Results 1 to 8 of 8

Help to divide a number from a variable cell

  1. #1
    Forum Contributor
    Join Date
    10-12-2011
    Location
    Sydney
    MS-Off Ver
    Excel 2016 in 2024
    Posts
    857

    Help to divide a number from a variable cell

    Hi,

    I am looking to copy some data from one worksheet to another, based on a number of variables,

    One of these includes to divide a number found in a cell by 100. However I can't get it to work.

    I get a "Division by zero" error.

    Can anyone please help out?

    Please Login or Register  to view this content.

  2. #2
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Help to divide a number from a variable cell

    This will do it for you

    Please Login or Register  to view this content.
    Or

    Please Login or Register  to view this content.
    Replace this line

    Please Login or Register  to view this content.
    With

    Please Login or Register  to view this content.


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  3. #3
    Forum Contributor
    Join Date
    10-12-2011
    Location
    Sydney
    MS-Off Ver
    Excel 2016 in 2024
    Posts
    857

    Re: Help to divide a number from a variable cell

    Quote Originally Posted by :) Sixthsense :) View Post
    This will do it for you

    Please Login or Register  to view this content.
    Or

    Please Login or Register  to view this content.
    Replace this line

    Please Login or Register  to view this content.
    With

    Please Login or Register  to view this content.
    thanks Sixthsense. I used the last line of code but still get the same error:

    Run-time error '11':
    Division by zero

  4. #4
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,908

    Re: Help to divide a number from a variable cell

    As I understand it you first wanna divide and then compare ?

    Please Login or Register  to view this content.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  5. #5
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Help to divide a number from a variable cell

    Quote Originally Posted by maym View Post
    thanks Sixthsense. I used the last line of code but still get the same error:
    Added error handler for both

    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    10-12-2011
    Location
    Sydney
    MS-Off Ver
    Excel 2016 in 2024
    Posts
    857

    Re: Help to divide a number from a variable cell

    thanks to you both. I had it around the wrong way but I have since used:

    Please Login or Register  to view this content.
    It appears to be working ok but I will need to do some checking and testing.

  7. #7
    Forum Contributor
    Join Date
    10-12-2011
    Location
    Sydney
    MS-Off Ver
    Excel 2016 in 2024
    Posts
    857

    Re: Help to divide a number from a variable cell

    I now need to multiply this number by 100 (to get to a percentage), but I have used this with no success:

    If Sheets(j).Cells(i, 4).Offset(2).Value <= (100 / Sheets(j).Cells(i, 4).Offset(3).Value * 100) Then

    Is that correct?

    So e.g. my cell has 3 in it. I need to do 100/3 = 33/100 = 0.33

  8. #8
    Forum Contributor
    Join Date
    10-12-2011
    Location
    Sydney
    MS-Off Ver
    Excel 2016 in 2024
    Posts
    857

    Re: Help to divide a number from a variable cell

    got it (I think) by using this:

    Please Login or Register  to view this content.

+ 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 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
  2. [SOLVED] Divide a Cell by the number of populated cells in a column
    By MATU70 in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 04-11-2014, 06:49 AM
  3. [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
  4. Divide a number within a cell in a specific section?
    By Kapcha in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-30-2012, 03:16 PM
  5. Replies: 1
    Last Post: 07-14-2010, 04:05 PM
  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

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