+ Reply to Thread
Results 1 to 16 of 16

Help with If, Match, Index, and Randbetween all in one formula

  1. #1
    Registered User
    Join Date
    05-02-2017
    Location
    Scranton, PA
    MS-Off Ver
    2010
    Posts
    11

    Help with If, Match, Index, and Randbetween all in one formula

    Please help with three different formulas.

    1. Test Plan tab, Cell E4 "POS" - Look for the Max date on the General tab (Column L "Fee Effective Date" should be 4/1/2017), If there is a P2 in Column O of the General tab ("Note Code 1") then enter 12, if not enter at random 11 or 22 in cell E4 on the Test Plan tab

    2. Test Plan tab, Cell C4 "Procedure Code" - Look for the Max date on the General tab Column L, if the POS on the Test Plan tab equals 12 and Column O of the General tab equals P2, Test Plan tab Cell G4 "FRM Age" equals Column F "Frm" on the General tab, Test Plan tab Cell H4 "Thru Age" equals Colum G "Thru" on the General tab, then enter at random a Procedure code from Column C on the General tab in cell C4 on the Test Plan Tab

    Look for the Max date on the General tab Column L, If the POS on the Test Plan tab equals 11, Test Plan tab Cell G4 "FRM Age" equals Column F "Frm" on the General tab, Test Plan tab Cell H4 "Thru Age" equals Colum G "Thru" on the General tab, then enter at random a Procedure code from Column C on the General tab in cell C4 on the Test Plan Tab


    Look for the Max date on the General tab Column U, If the POS on the Test Plan tab equals 12, and Test Plan tab Cell G4 "FRM Age" equals Column F "Frm" on the General tab, and Test Plan tab Cell H4 "Thru Age" equals Colum G "Thru" on the General tab, then enter at random a Procedure code from Column C on the General tab in cell C4 on the Test Plan Tab


    3. Test Plan tab, Cell D4 "Modifier" - IF the POS on the template tab is either 11 or 12, Look for the Max date on the General tab Column L, if Procedure Code Cell C4 equals General Tab Column C, Test Plan tab Cell G4 "FRM Age" equals Column F "Frm" on the General tab, and Test Plan tab Cell H4 "Thru Age" equals Colum G "Thru" on the General tab, then enter at random a Modifier code from Column D on the General tab in cell D4 on the Test Plan Tab


    IF the POS on the template tab is 22, Look for the Max date on the General tab Column U, if Procedure Code Cell C4 equals General Tab Column C, Test Plan tab Cell G4 "FRM Age" equals Column F "Frm" on the General tab, and Test Plan tab Cell H4 "Thru Age" equals Colum G "Thru" on the General tab, then enter at random a Modifier code from Column D on the General tab in cell D4 on the Test Plan Tab

    I am definitely open to suggestions and simplification. Thanks in advance for your support.

    Sherline
    Attached Files Attached Files

  2. #2
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Help with If, Match, Index, and Randbetween all in one formula

    You literally have a thousand plus April firsts in column L. Which one do you want to use?
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

  3. #3
    Registered User
    Join Date
    05-02-2017
    Location
    Scranton, PA
    MS-Off Ver
    2010
    Posts
    11

    Re: Help with If, Match, Index, and Randbetween all in one formula

    Yes, that is why I wanted to also use the randbetween to look at all of them and just select one where all the criteria is met.

  4. #4
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Help with If, Match, Index, and Randbetween all in one formula

    So look at all the 4/1 dates and see if any of them contains a PS? They way you describe the requirement, there is nothing on the Test Plan sheet that influences this so all of column E will have the same answer.

  5. #5
    Registered User
    Join Date
    05-02-2017
    Location
    Scranton, PA
    MS-Off Ver
    2010
    Posts
    11

    Re: Help with If, Match, Index, and Randbetween all in one formula

    That's ok so as of the date of 4/1/2017 there are no P2. Maybe on a future date there will as the General tab is updated quarterly.
    Nonetheless the formula should still account for that possibility. Since there is no P2 then the output should either be 11 or 22.

  6. #6
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Help with If, Match, Index, and Randbetween all in one formula

    So all I need to do is make one calculation and paste the results into all the rows in column E? Column E will either be all 12's (if any of the 4/1's has a P2 associated with it) or a mix of 11's and 22's (if none of the 4/1's has a P2 associated with it), is this correct? It does not matter what else might be on the row on the Test Plan sheet.

  7. #7
    Registered User
    Join Date
    05-02-2017
    Location
    Scranton, PA
    MS-Off Ver
    2010
    Posts
    11

    Re: Help with If, Match, Index, and Randbetween all in one formula

    Yes you are correct. Column E would be either all 12's or a mix of 11's and 22's.

  8. #8
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Help with If, Match, Index, and Randbetween all in one formula

    Got it! OK

  9. #9
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Help with If, Match, Index, and Randbetween all in one formula

    I got the first formula now i need help with

    2.Test Plan tab, Cell C4 "Procedure Code" - Look for the Max date on the General tab Column L, if the POS on the Test Plan tab equals 12 and Column O of the General tab equals P2, The way I am reading this is if The POS on the test plan is 12 then ??? The other criteria are redundant, but I don't know what you want to do with cell C4 because you immediately start talking about cell G4.

    Test Plan tab Cell G4 "FRM Age" equals Column F "Frm" on the General tab, Cell G4 = Column F on General Tab - what row?


    Test Plan tab Cell H4 "Thru Age" equals Column G "Thru" on the General tab, then enter at random a Procedure code from Column C on the General tab in cell C4 on the Test Plan Tab
    Again, what row?

    I'll move onto part 3 when we get this straightened out.

    Here is formula 1: =IF(SUMPRODUCT((Table_General[Fee Effect Date]=MAX(Table_General[Fee Effect Date]))*(Table_General[Note Codes]="P2"))=0,IF(RAND()>0.5,11,22),12)
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    05-02-2017
    Location
    Scranton, PA
    MS-Off Ver
    2010
    Posts
    11

    Re: Help with If, Match, Index, and Randbetween all in one formula

    Ok so now we know that the POS will be either all 12's or 11 and 22's.

    2. If the POS is 12 (Test Plan Column E) then find the Max date (General Column L) and P2 (General Column O) the following criteria must all match:
    Test Plan Column G "Frm Age" = General Column F "Frm"
    Test Plan Column H "Thru Age" = General Column G :"Thru"

    If the POS is 11 (Test Plan Column E) then find the Max date (General Column L) and General Column O is blank the following criteria must all match:
    Test Plan Column G "Frm Age" = General Column F "Frm"
    Test Plan Column H "Thru Age" = General Column G :"Thru"

    If the POS is 22 (Test Plan Column E) then find the Max date (General Column U) and the following criteria must all match:
    Test Plan Column G "Frm Age" = General Column F "Frm"
    Test Plan Column H "Thru Age" = General Column G :"Thru"

    The output would be placed in Test Plan Column C which is a randbetween of the procedure codes (General Column C) that match the criteria. Each line on the test plan may have a different age grouping, which is fine, and duplicated are fine also. The formula would be copied down beginning with C4 on the Test Plan

  11. #11
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Help with If, Match, Index, and Randbetween all in one formula

    I'm still not getting this. What row? How do I match a row on the test plan sheet with a row on the general sheet?

    Let's take the case where POS is 11. I find the max date on the general tab, those 1,000 or so 4/1 dates. I look at Column O - which row in column O? then I match TP.Column G with Gen.Column F. There are multiple matches. How do I deal with this? Then I match TP.H with Gen.G. Once again, I have multiple matches. And finally in which cell do I put this data and what do I put into this cell?

  12. #12
    Registered User
    Join Date
    05-02-2017
    Location
    Scranton, PA
    MS-Off Ver
    2010
    Posts
    11

    Re: Help with If, Match, Index, and Randbetween all in one formula

    Ok, if row 4 on the test plan has a POS of 11 Frm age 21 Thru age 999 find the same value on the General Frm and Thru column (which would be several) that has the 4/1 date return any one at random of the procedure codes on the test plan C4 ie "80050". I hope that makes sense..

  13. #13
    Registered User
    Join Date
    05-02-2017
    Location
    Scranton, PA
    MS-Off Ver
    2010
    Posts
    11

    Re: Help with If, Match, Index, and Randbetween all in one formula

    im trying to work it like this

    =INDEX(General!$C$28:$AA$18898,MATCH(1,(General!$f$28:$f$18898='Test Plan'!g4)*(General!$G$28:$G$18898='Test Plan'!h4)* if POS is 11 find max date in General!$L$28:$L$18898, randbetween General!$C$28:$C$18898, if pos is 22 find max date in General!$U$28:$U$18898, randbetween General!$C$28:$C$18898

    the output will be in test plan c4
    Last edited by shpaul; 06-02-2017 at 11:52 AM.

  14. #14
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Help with If, Match, Index, and Randbetween all in one formula

    Let me see if I can describe the requirement. I look at the test plan. I get the POS. I also only consider records in General if they match the max date. Then I look at the FRM Age and the Thru Age. I don't know what to do with these as there are, again multiple matches. Then I look at the POS. If the POS is 11 I get a random number from Column C in General if is is 22 I get a random number from Column U in General if it is 12 then ???

    I think you are going to have to get someone else to help you with this sheet. No matter how you try to explain the requirements to me, I'm just not getting it. Perhaps another set of eyeballs is required.

  15. #15
    Registered User
    Join Date
    05-02-2017
    Location
    Scranton, PA
    MS-Off Ver
    2010
    Posts
    11

    Re: Help with If, Match, Index, and Randbetween all in one formula

    If anyone else have any suggestions I would appreciate it. This is the formula I am working on for the procedure code

    =IF(AND(SUMPRODUCT((Table_General[Fee Effect Date]=MAX(Table_General[Fee Effect Date]))*(Table_General[Frm]=[@[FRM Age]])*(Table_General[Thru]=[@[THRU Age]]))),INDEX(Table_General[Proc Code],RANDBETWEEN(1,COUNTA(Table_General[Proc Code]))),0)

    it does return a value, however it does not match the date so therefore its the wrong value.

  16. #16
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Help with If, Match, Index, and Randbetween all in one formula

    You might want to post a fresh post and cross-reference this one. With 15 replies, you may not get many takers.

+ 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: 4
    Last Post: 04-14-2017, 07:47 PM
  2. Index Match formula changing my Index daily
    By vitt4300 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 03-31-2017, 02:19 PM
  3. [SOLVED] This formula works but I donīt understand why Index(Index) match
    By campelliann in forum Excel General
    Replies: 2
    Last Post: 01-25-2016, 05:55 PM
  4. [SOLVED] Selecting data to use with RANDBETWEEN and INDEX
    By MargateSteve in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-06-2013, 05:12 AM
  5. Replies: 3
    Last Post: 05-02-2013, 01:31 AM
  6. Index Match Index Formula work slow
    By avk in forum Excel General
    Replies: 9
    Last Post: 03-07-2012, 02:19 PM
  7. Replies: 5
    Last Post: 02-29-2012, 08:51 PM

Tags for this Thread

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