# 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.  Register To Reply

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?  Register To Reply

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  Register To Reply

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  Register To Reply

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!  Register To Reply

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!   Register To Reply

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  Register To Reply