Consulting

Results 1 to 4 of 4

Thread: Excel Function -Address

  1. #1
    VBAX Regular
    Joined
    Jan 2017
    Location
    Warsaw
    Posts
    70
    Location

    Excel Function -Address

    Hey guys
    !
    Although it is not a VBA code, but maybe can help me Yes nonetheless.

    I want to perform the following function:
    =ROUND(LOOKUP(RAND(); ADDRESS (22) (COLUMN ((INDEX(tblData!2:2;))) MATCH(B1;tblData!2:2;0))):address(50;(column((index(tblData!2:2; MATCH(B1;tblData!2:2;0)))+1));1)

    Unfortunately, I get the error that the function contains an error. I think this is the area ADDRESS: ADDRESS.
    The formula are in the original condition as:
    =ROUND(LOOKUP(RAND(); initalcell: end cell; 1).

    The initial cell is determined as follows:
    ADDRESS (22) (COLUMN ((INDEX(tblData!2:2;))) MATCH (B1;tblData!2:2;0)))

    The end cell according to the same logic.


    How do I clean the addresses of both cells now in my function?
    Last edited by Bob Phillips; 08-02-2017 at 04:07 PM.

  2. #2
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Can you post a sample workbook?
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  3. #3
    VBAX Regular
    Joined
    Jan 2017
    Location
    Warsaw
    Posts
    70
    Location
    Oh, damn, I did not manage to upload the file. I'm also back in the office on next monday.

    I hope, however, to get on with the following description.

    The function has the following structure: = ROUND (LOOKUP (RAND (); tblData! C22: tblData! D39); 1)

    The initial line should be defined according to the following formula:
    "! tblData" = ADDRESS (22; (COLUMN ((INDEX (tblData 2: 2; MATCH (B1; tblData 2:! 2; 0))))))

    The end line according to the following logic:
    "! tblData" = ADDRESS (50; (COLUMN ((INDEX (tblData 2: 2; MATCH (B1; tblData 2: 2; 0))))) + 1)

    The sum is thus as follows:
    =ROUND(LOOKUP(RAND();"tblData!"&ADDRESS(22;(COLUMN((INDEX(tblData!2:2;MATCH (B1;tblData!2:2;0)))))):"tblData!"&ADDRESS(50;(COLUMN((INDEX(tblData!2:2;MA TCH(B1;tblData!2:2;0)))))+1);1)

    Unfortunately Excel recognizes an error, but does not say exactly where.
    It is probably due to the addressing of the two cells. Where is the mistake?







  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Try this formula

    =ROUND(LOOKUP(RAND();OFFSET($A$1;21;MATCH(B1;tblData!2:2;0)-1;50-22+1;2));1)
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Posting Permissions

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