+ Reply to Thread
Results 1 to 6 of 6

FORMULA for DIVISORS

  1. #1
    Registered User
    Join Date
    12-25-2015
    Location
    india
    MS-Off Ver
    5.0
    Posts
    14

    FORMULA for DIVISORS

    Can any one tell me the formula to find all the divisors of a number in an excel sheet

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: FORMULA for DIVISORS

    Hi, ans welcome to the forum

    The following UDF would be one way

    Please Login or Register  to view this content.
    Enter
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    where A1 contains your number
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: FORMULA for DIVISORS

    What version of excel are you using?

    This requires Excel 2007 or later.

    Data Range
    A
    B
    C
    D
    E
    F
    G
    H
    I
    J
    K
    1
    Number
    Divisors
    2
    27
    1
    3
    9
    27
    3
    82
    1
    2
    41
    82
    4
    13
    1
    13
    5
    100
    1
    2
    4
    5
    10
    20
    25
    50
    100
    6
    ------
    ------
    ------
    ------
    ------
    ------
    ------
    ------
    ------
    ------
    ------


    This array formula** entered in B2:

    =IFERROR(SMALL(IF(MOD($A2,ROW(INDIRECT("1:"&$A2)))=0,ROW(INDIRECT("1:"&$A2))),COLUMNS($B2:B2)),"")

    ** array formulas need to be entered using the key
    combination of CTRL,SHIFT,ENTER (not just ENTER).
    Hold down both the CTRL key and the SHIFT key
    then hit ENTER.

    Copy down as needed then across until you get blanks.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  4. #4
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP, 2007, 2024
    Posts
    16,437

    Re: FORMULA for DIVISORS

    If I understand the proposed code/formula, these look like basic "trial division" algorithms for factorization, which would work very well for small numbers like Tony Valko lists in his example. If you want to explore faster and more efficient algorithms (if your end goal is to factor much larger integers), you might want to do a little research into the Sieve of Eratosthenes (https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes ) or Wheel factorization (https://en.wikipedia.org/wiki/Wheel_factorization ) or any of the other prime factorization algorithms ( https://en.wikipedia.org/wiki/Integer_factorization ). Your question is not specifically limited to prime factors. Non-prime factors would be different combinations of the prime factors, so these prime factorization algorithms could make a good starting point.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  5. #5
    Registered User
    Join Date
    12-25-2015
    Location
    india
    MS-Off Ver
    5.0
    Posts
    14

    Re: FORMULA for DIVISORS

    Thank you all for the reply, It was useful

  6. #6
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: FORMULA for DIVISORS

    You're welcome. We appreciate the feedback!

    If your question has been solved please mark the thread as being solved.

    In the menu bar above the very first post select Thread Tools, then select Mark this thread as solved.

+ 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: 11
    Last Post: 06-06-2014, 03:34 PM
  2. how to hide formula in formula box, view lookup result in formula box?
    By vengatvj in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-14-2013, 04:06 PM
  3. Multiple conditional formatting - overcoming -ve divisors
    By Monkeyfuzzle in forum Excel General
    Replies: 1
    Last Post: 11-15-2011, 12:23 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