+ Reply to Thread
Results 1 to 7 of 7

Advanced If or Match(index) vba... not really sure.

  1. #1
    Registered User
    Join Date
    08-13-2015
    Location
    Houston, Texas
    MS-Off Ver
    2010
    Posts
    61

    Advanced If or Match(index) vba... not really sure.

    I'm asking the excel gods to assist me with this problem I am having.
    I need help in creating a vba for the following:TRFA.xlsx

    In sheet 1 of my excel, I need to fill in column I and J.

    Column I and J's data in on sheet 2 "Terminal Reserve File Factors."

    In sheet1, If the *** is Male (column B), then you use the Terminal Reserve File for Males (column F).
    If the *** is Female (column B), then you use the Terminal Reserve File for Females (column G).

    The next step is now that you have the issue age (column C), duration (column E), and the right Terminal Reserve File, you can get the Factor (column D) that is in worksheet, "Terminal Reserve File Factors."

    Column I would be the corresponding Factor based on the Terminal Reserve File, Issue Age, Duration, and ***.
    Column J would be the subsequent factor.


    The attachment is a small snippet of the real file, which was too large to upload.
    I did an example in I2:J2. The larger file looks just like the only I uploaded except for the fact sheet one has 16032 rows and sheet two has 672031 rows.
    There are a couple policies where there is no terminal reserve file (column F or G), so skip.
    Last edited by TexasBobcat; 08-31-2015 at 12:48 PM.

  2. #2
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Advanced If or Match(index) vba... not really sure.

    I inserted a Col A in your Terminal Reserve File Factor Sheet
    =F2&D2&C2 copied down

    Then in I2 of Sheet1 copied down
    =IFERROR(INDEX('Terminal Reserve File Factor'!$E$2:$E$776, MATCH(B2&E2&C2, 'Terminal Reserve File Factor'!$A$2:$A$776,0)),"")

    In H2
    =IFERROR(INDEX('Terminal Reserve File Factor'!$E$2:$E$776, MATCH(B2&E2&C2, 'Terminal Reserve File Factor'!$A$2:$A$776,0)+1),"")
    Attached Files Attached Files
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

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

  3. #3
    Registered User
    Join Date
    08-13-2015
    Location
    Houston, Texas
    MS-Off Ver
    2010
    Posts
    61

    Re: Advanced If or Match(index) vba... not really sure.

    Quote Originally Posted by ChemistB View Post
    I inserted a Col A in your Terminal Reserve File Factor Sheet
    =F2&D2&C2 copied down

    Then in I2 of Sheet1 copied down
    =IFERROR(INDEX('Terminal Reserve File Factor'!$E$2:$E$776, MATCH(B2&E2&C2, 'Terminal Reserve File Factor'!$A$2:$A$776,0)),"")

    In H2
    =IFERROR(INDEX('Terminal Reserve File Factor'!$E$2:$E$776, MATCH(B2&E2&C2, 'Terminal Reserve File Factor'!$A$2:$A$776,0)+1),"")
    This code doesn't seem to work.

  4. #4
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Advanced If or Match(index) vba... not really sure.

    Hmmm, looking at my file, can you give some examples of what you would expect as opposed to what I got? In the example, it only gave numbers for row 2 and 6 but I figured that was because you said you cleared a lot of data.

  5. #5
    Registered User
    Join Date
    08-13-2015
    Location
    Houston, Texas
    MS-Off Ver
    2010
    Posts
    61

    Re: Advanced If or Match(index) vba... not really sure.

    I expect to get all the factor values. In your excel, only I6:J6 have a factor. Every cell should have a factor number as long as it has a terminal reserve file number (column f or g). In my larger file I have 672031 rows in sheet two and 16k in sheet 1. WHat I gave you was just a small portion of my whole worksheet.

  6. #6
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Advanced If or Match(index) vba... not really sure.

    Okay, so in your example, for the TRFF (Terminal Reserve File Factor) tab, you only have M under the *** column. On Sheet1, row 4 for exaample, the *** is female. How would that get a Factor value?

    Another example, Row 3 is Male with a duration of 25 and an issue age of 37. There are no rows in TRFF tab that match that issue age.

  7. #7
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Advanced If or Match(index) vba... not really sure.

    Hi TexasBobcat,

    See the attached file which has a VBA solution that contains the following code:
    Please Login or Register  to view this content.
    Lewis
    Attached Files Attached Files

+ 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. Replies: 3
    Last Post: 01-16-2015, 03:59 PM
  2. Using "Index & match" Formula but in an advanced way can anyone help please???
    By knight_craig in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-19-2014, 04:39 AM
  3. Replies: 6
    Last Post: 04-30-2014, 02:42 AM
  4. [SOLVED] Advanced Match Help (possibly Index Match)
    By dfxryanjr in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 08-08-2013, 09:13 AM
  5. Replies: 7
    Last Post: 08-10-2010, 04:05 PM
  6. advanced lookup/index-match problem
    By tx12345 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-11-2006, 12:40 PM
  7. advanced lookup/index-match problem
    By tx12345 in forum Excel General
    Replies: 1
    Last Post: 08-10-2006, 11: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