+ Reply to Thread
Results 1 to 10 of 10

Substitute Formula for Cell ID in Range

Hybrid View

  1. #1
    Registered User
    Join Date
    08-20-2013
    Location
    Orange County, USA
    MS-Off Ver
    Excel 2007
    Posts
    8

    Substitute Formula for Cell ID in Range

    Hello Excel Experts,

    I have a large sheet containing 89,000 records. I want to be able to substitue the Cell ID in the Range of a INDEX(RAND) formula based on the content of the "Item Split" column. Is this at all possible?

    Example below: The Random Nos column below contains the funtion RAND(). The Select SO column below contains the combined function of =INDEX($C$2:$C$13,RANK(D2,$D$2:$D$13)).

    Item Split Item SO No Random Nos Selected SO
    2 06038 3589640 0.539426323 3633384
    1 06038 3606267 0.542146952 3628200
    1 06038 3616141 0.109259033 5472190
    1 06038 3628200 0.127723086 5471537
    1 06038 3633384 0.301287132 3634581
    1 06038 3634581 0.086179261 7235466
    1 06038 5470075 0.635229821 3616141
    1 06038 5471537 0.093626961 5475256
    1 06038 5472190 0.638983519 3606267
    1 06038 5475256 0.2037447 5470075
    1 06038 7235466 0.053662117 7237487
    3 06038 7237487 0.879992684 3589640

    I want to substitue a formula in the combined function that will select the Row Number into the range based on the "Item Split" column, where IF "Item Split" = 2, then use that row number, Else IF "Item Split" = 3, than use that row number.

    Conceptually, the formula would look like: =INDEX($C$(formula):$C$(formula),RANK(D2,$D$(formula):$D$(formula)))

    Pleae help. This would help me emensly in managing this large amount of data and save hous of time.

    Thanks,

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Substitute Formula for Cell ID in Range

    Please upload a workbook or a representative cut down copy, anonymised if necessary. It is always easier to advise if we can see your request in its context.

    Show a before and after situation and if it's not blindingly obvious how you have arrived at your results some explanatory notes as well.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    08-20-2013
    Location
    Orange County, USA
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Substitute Formula for Cell ID in Range

    Uploaded example file as suggested.
    Attached Files Attached Files

  4. #4
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Substitute Formula for Cell ID in Range

    I'm not 100% sure this is what you need, but give it a try and let us know.
    Using your sample file, in cell E2 and copied down:
    =IF(OR(COUNTIF(A$2:A2,2)=0,COUNTIF(A$1:A1,3)>0),"",INDEX(INDEX(C:C,MATCH(2,A:A,0)):INDEX(C:C,MATCH(3,A:A,0)),RANK(D2,INDEX(D:D,MATCH(2,A:A,0)):INDEX(D:D,MATCH(3,A:A,0)))))
    Hope that helps,
    ~tigeravatar

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  5. #5
    Registered User
    Join Date
    08-20-2013
    Location
    Orange County, USA
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Substitute Formula for Cell ID in Range

    Thanks tigeravatar.

    This works but I neglected to provide important criteria. I need the sequence to begin again each time the Item Number changes in the "Item" Column. I have attached a second file illustrating the situation called Index Random Example for Forum R2.xls. Sorry about that.

    Please advise.

    Many thanks.
    Attached Files Attached Files

  6. #6
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Substitute Formula for Cell ID in Range

    In cell E2 and copied down:
    =INDEX(INDEX(C:C,LOOKUP(2,1/(A$2:A2=2),ROW(A$2:A2))):INDEX(C:C,MATCH(3,A2:A$952,0)+ROW(A1)),RANK(D2,INDEX(D:D,LOOKUP(2,1/(A$2:A2=2),ROW(A$2:A2))):INDEX(D:D,MATCH(3,A2:A$952,0)+ROW(A1))))

  7. #7
    Registered User
    Join Date
    08-20-2013
    Location
    Orange County, USA
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Substitute Formula for Cell ID in Range

    Thanks tigeravatar.

    That worked perfectly.

  8. #8
    Registered User
    Join Date
    08-20-2013
    Location
    Orange County, USA
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Substitute Formula for Cell ID in Range

    I am sorry tigeravatar, but I was premature in my congratulations. The output does not validate.

    The random selection of the "SO No" needs to be restricted to only those SO No's for each Item Number. This is not happening.

    When I compare the SO No Column to the calculated Selected SO Column, the exact same SO No's should appear in the Selected SO Column as in the SO No Column for just that Item Number, only resorted by rank.

    Please take another look and let me know if you can help.

    Thanks again.

  9. #9
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Substitute Formula for Cell ID in Range

    jerry.fein,

    I manually double-checked it and it is indeed working properly. You just have a lot of duplicate SO No's in each section.

  10. #10
    Registered User
    Join Date
    08-20-2013
    Location
    Orange County, USA
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Substitute Formula for Cell ID in Range

    Hi tigeravatar

    Yes, you are correct. It did work perfectly. I had two issues that were affecting the output.
    1. I didn't notice until today that I had to adjust the formula to encompass the last record of the sheet.
    2. I had to split the sheet into 5 seperate sheets because of system resource issues. After all I was dealing with 89000 records.

    In the end, it worked just fine.

    Thanks again for the help.

+ 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. Please help with a =SUBSTITUTE formula with html code in the cell
    By rcheltrvel in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 05-12-2013, 06:01 PM
  2. Excel 2003 - VBA to substitute value from cell in formula
    By Belgarath75 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-23-2013, 06:51 AM
  3. [SOLVED] Vlookup or If/Then to return a substitute cell for a cell that matches itself in a range
    By Shadefalcon in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 11-13-2012, 06:02 PM
  4. Formula to identify substitute items in a cell?
    By ravikumar00008 in forum Excel General
    Replies: 10
    Last Post: 05-31-2012, 10:27 AM
  5. How to use a substitute formula to substitute text entries to a different text entry
    By andybocchi in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 11-01-2010, 07:50 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