Closed Thread
Results 1 to 11 of 11

Decomposition in Prime Factors

  1. #1
    Registered User
    Join Date
    06-11-2011
    Location
    san francisco
    MS-Off Ver
    Excel 2007
    Posts
    9

    Decomposition in Prime Factors

    Hi,

    I am looking for a script to decompose a list of numbers into their prime factors.

    Attached is a file with an example of what I am looking for.

    Thanks for your help,

    Philippe
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326

    Re: Decomposition in Prime Factors

    Google search on "decomposition in prime factors +excel" yielded more than 100 k answers -

  3. #3
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Decomposition in Prime Factors

    Please Login or Register  to view this content.
    E.g.,

    Please Login or Register  to view this content.
    Last edited by shg; 07-03-2011 at 07:29 PM.
    Entia non sunt multiplicanda sine necessitate

  4. #4
    Registered User
    Join Date
    06-11-2011
    Location
    san francisco
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: Decomposition in Prime Factors

    Hi,

    I tried this code but got this error message: Argument not optional

    Any idea of what is wrong?

    Philippe

  5. #5
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Decomposition in Prime Factors

    "Tried it" in what way?

  6. #6
    Registered User
    Join Date
    06-11-2011
    Location
    san francisco
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: Decomposition in Prime Factors

    I created a module with the code.

    Then pressed alt f8 and made the Factors function run.

    This is when I received the error message.

  7. #7
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Decomposition in Prime Factors

    You used a formula on a worksheet, or wrote code to test it? If the latter, post the code.

  8. #8
    Registered User
    Join Date
    06-11-2011
    Location
    san francisco
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: Decomposition in Prime Factors

    Hi,

    I could figure out what what went wrong.

    I wasn't applying the function properly in the cells.

    Thank you for your patience, sorry I am kind of an absolute beginner in Excel.

    Philippe

  9. #9
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Decomposition in Prime Factors

    Well done, glad you got it sorted out.

  10. #10
    Registered User
    Join Date
    05-31-2012
    Location
    Columbus, Ohio
    MS-Off Ver
    Excel 2010
    Posts
    1

    Re: Decomposition in Prime Factors

    I clicked select code copied the code then opened a new module in the vb editor and pasted the code in. then selected "close and return to excel" on the file menu. I selected a column of values and pressed Alt+F8 to view macros the macro doesn't appear on the list. So I looked at the code, didn't find "sub Marco_name()" or "end sub" so I deleted that module created a new one and typed "sub prime_factors()" and Enter. Then I pasted the code in between exited to excel and tried to run the macro by selecting a range of values typing "Alt+F8" and got the error "expecting endsub" what am I doing wrong please

  11. #11
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Decomposition in Prime Factors

    Captain Pedro,

    Welcome to the Forum, unfortunately:

    Your post does not comply with Rule 2 of our Forum RULES. Don't post a question in the thread of another member -- start your own thread. If you feel it's particularly relevant, provide a link to the other thread. It makes sense to have a new thread for your question because a thread with numerous replies can be off putting & difficult to pick out relevant replies.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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