+ Reply to Thread
Results 1 to 6 of 6

Return an array of numbers

  1. #1
    Registered User
    Join Date
    12-16-2003
    Location
    Fort Lupton, Colorado
    Posts
    5

    Return an array of numbers

    Is there a function or formula that that can return an array of numbers to a single cell? In other words, the formula would look at specific info, constants, variables, and then perform a calculation based on that criteria and return a group of numbers, each separated by a comma, into a single cell. Any help would be greatly appreciated. Thanks.

    Roy

  2. #2
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,065
    Don't be silly. You could however use the & and CONCATENATE function to manipulate the data in whatever way you wanted.
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  3. #3
    Registered User
    Join Date
    12-16-2003
    Location
    Fort Lupton, Colorado
    Posts
    5
    I'm not really trying to be silly. I'm running a program that uses Excel as its spreadsheet platform. It is a CAM program that generates machining for cabinet parts. It uses AutoCAD as its cad portion of the program. What I'm looking for is a way to generate a sequence of numbers that are coordinates for construction boring. As it sits right now, the program looks to a global variable for its sequence of coordinates but they are hard coded and so are limited to the number of coordinates that are listed. What I'm proposing is to have the global variable use a formula that looks a the part size and the calculates how many holes are needed for that length of part and returns the coordinates for those holes. I don't know, maybe its just wishful thinking.

    Roy

  4. #4
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675
    Hello Roy,

    What you want might be possible with formulas but in general it's easier to return an array of numbers to a range of cells rather than a single one because Excel doesn't have any native formulas that can concatenate a range (or array).

    Can you explain how the formula would work to generate the co-ordinates?

  5. #5
    Registered User
    Join Date
    12-16-2003
    Location
    Fort Lupton, Colorado
    Posts
    5
    The first thing it would look at would be a local variable that references the length of the part. It would then take that value and divide it by the value in a Global variable which would be the distance between the holes. The returned value would be the number of holes needed. The first hole is always an inch from the front edge of the part. Each subsequent hole would have a cumulative value of the hole distance Global variable added to 1. For example, if the distance between holes was 3, the first value would be 1, the next 4, then 7..etc. The desired syntax would be: 1,4,7,10,13 etc. The formula would have to be like a VB loop that would continue to calculate until the number of holes was reached. I just don't know how to get it to display a series of numbers separated by commas.

    Roy

  6. #6
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675
    As I said above, Excel doesn't have a native function that can concatenate a range but you might be able to use functions from the free morefunc add-in to assist you.

    I don't know if this is a little simplistic but assuming you have the part length in A1 and the distance between holes in B1 then this formula, using MCONCAT and INTVECTOR functions from morefunc should give the required result

    =MCONCAT(INTVECTOR(CEILING((A1-1)/B1,1),0)*B1+1,", ")

    formula needs to be confirmed with CTRL+SHIFT+ENTER

    example

    A1 = 47
    B1 = 4

    formula returns

    1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45
    Last edited by daddylonglegs; 10-17-2007 at 09:24 AM.

+ Reply to 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