# Outputting factors and prime factors of number into one cell

1. ## Outputting factors and prime factors of number into one cell

Hi, I've been trying to produce the factors of a number into a single cell. I have found the one for outputting them into a column, but need a few thousand, so cant have it in this format. I need randbetween(1,100) in column A and the factors in B. So A1=12 B1=1,2,3,4,6,12. The commas don't necessarily need to be there.

I also will need in the next step produce Prime factors in one single cell. Eg A1=12 B1=2, 2, 6

Sorry if it's been asked before, but I've had a search and can't quite find what I need.

2. ## Re: Outputting prime factors of number into one cell

1,2,3,4,6 and 12 are all the factors, not the prime factors. Which one do you need?

3. ## Re: Outputting prime factors of number into one cell

Sorry. I need all the factors.

But thinking about it, I will need Prime factors also in the same format in the not too distant future so if you know a way to do either that would be great!

Thanks

4. ## Re: Outputting factors and prime factors of number into one cell

Put this in a code module:
``Please Login or Register  to view this content.``
If A1 contains 123331060025819, then =Factors(A1) returns 113,12517,87195439

5. ## Re: Outputting factors and prime factors of number into one cell

Ok, Sorry but I'm a bit of a novice when it comes to this, but I have opened my macros screen thing, copied n pasted the code. Now what do I do? I used a bit of initiative and found the =isprime so typed that into the cell, but it just come out as 'true' or 'false' not with the actual factors.

Thanks very much!

6. ## Re: Outputting factors and prime factors of number into one cell

Alt F11 is the shortcut. Then insert a module and paste it in.

Nice code, shg!

7. ## Re: Outputting factors and prime factors of number into one cell

Ok found the right function, works great!!

Any way to get all factors out not just Prime Factors?

Also, is there any way to output these factors (prime and otherwise) into different cells in the same row?

eg A1=12 B1=2 C1=2 D1=2 E1=3

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

#### 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