Consulting

Results 1 to 3 of 3

Thread: VBA Mac coding Question

  1. #1
    VBAX Newbie
    Joined
    Feb 2021
    Posts
    1
    Location

    VBA Mac coding Question

    Trying to write code to show prime numbers 3-1000, then show the sum of the digits of each of those prime numbers, and ultimately just show the prime numbers whose sum is prime. Example the number is 11 to show 1+1=2, 2 would also be shown because it is also a prime number. I have the code working for prime numbers, however cannot get it to sum the digits or show the summed primes. Please help!

  2. #2
    Moderator VBAX Guru Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    4,997
    Location
    Have you tried this?
    =SUMPRODUCT(--MID(A1,ROW(INDIRECT("1:" & LEN(A1))),1))
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

  3. #3
    I see this was posted a few months ago. Are you still working on the problem? If so, you mention the sum of digits of 11 is 2 and 2 is prime. Are you summing all the digits of all the primes or only the sum of the digits that result in a prime sum? Are you doing this all in VBA or are you displaying all primes <1000 on a spreadsheet?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •