+ Reply to Thread
Results 1 to 6 of 6

Listing the numbers that make up a certain sum

  1. #1
    Registered User
    Join Date
    07-17-2021
    Location
    turkey
    MS-Off Ver
    office 365
    Posts
    3

    Listing the numbers that make up a certain sum

    hello first of all;

    I am an amateur in vba and english, sory!
    how can i speed up the following code. I know it's a lot of loops, but that's all I could do. Thank you in advance for your help.

    Please Login or Register  to view this content.

  2. #2
    Registered User
    Join Date
    07-17-2021
    Location
    turkey
    MS-Off Ver
    office 365
    Posts
    3

    Re: Listing the numbers that make up a certain sum

    Is there any experts to help?

  3. #3
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: Listing the numbers that make up a certain sum

    Rather than asking to fix your code, explain exactly what you are trying to do.
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  4. #4
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: Listing the numbers that make up a certain sum

    Quote Originally Posted by anticode View Post
    Is there any experts to help?
    Hi,

    as you forgot to attach your workbook and to well elaborate at least your need, in fact all in the initial post any Excel forum expects for …

  5. #5
    Forum Expert
    Join Date
    08-17-2007
    Location
    Poland
    Posts
    2,206

    Re: Listing the numbers that make up a certain sum

    It's probably supposed to work like this:
    1. Create a square matrix (as shown in the picture, but in memory) from a one-dimensional array Array(10, 20, 30, 40, 50, 60, 70, 80, 90)
    2. Find and list numbers when:
    a / the sum in the row is 150
    b / the sum in the column is 150
    c / the sum of one diagonal is 150
    d / the sum of the other diagonal is 150.

    For this example, we should get the following set of numbers:
    Ad. a/ 40,50,60
    Ad. b/ 20,50,80
    Ad. c/ 10,50,90
    Ad. d/ 30,50,70

    The macro is also supposed to work on larger matrices, at least 4x4, 5x5
    But that's only the author of the thread knows exactly.

    If that's how it is supposed to work, the author has very complicated the calculations in the code.

    Artik
    Attached Images Attached Images

  6. #6
    Registered User
    Join Date
    07-17-2021
    Location
    turkey
    MS-Off Ver
    office 365
    Posts
    3

    Re: Listing the numbers that make up a certain sum

    I made the explanation in the code, but it wasn't very enlightening. my fault, now I added the excel file

    actually the problem is alphamagical squares


    in summary as follows;

    5 22 18
    28 15 2
    12 8 25


    the sum of all rows, columns and diagonals is 45



    five twenty-two eighteen
    twenty-eight fifteen two
    twelve eight twenty-five

    The new square formed by the character lengths of the writing of the numbers has a similar feature. then this is an alphamagical square

    example: five= 4 character

    4 9 8
    11 7 3
    6 5 10

    the sum of all rows, columns and diagonals is 21


    what I am looking for is how many different ways the numbers in column A can form magic squares and listing them.

    note: When I log in as a member, the png file sent by dear Artik does not appear


    book matrix - Kopya.xlsx

+ 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. Listing most frequent set of numbers
    By Ram_6833 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-17-2019, 12:00 PM
  2. [SOLVED] Listing Row Numbers
    By Johnny0811 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 04-21-2017, 04:47 AM
  3. [SOLVED] Listing even and odd numbers
    By szasz in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-26-2013, 02:31 PM
  4. [SOLVED] Listing missing numbers
    By Statz in forum Excel General
    Replies: 7
    Last Post: 10-16-2012, 01:08 PM
  5. Listing all combinations of 6 out of 10 numbers?
    By Faux Carnival in forum Excel General
    Replies: 4
    Last Post: 11-06-2010, 07:38 AM
  6. Listing possible combinations of numbers
    By Rgaherty in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-02-2010, 09:39 PM
  7. listing numbers in column
    By jgclickfind in forum Excel General
    Replies: 6
    Last Post: 05-20-2005, 04:22 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