lundi 1 août 2016

Excel formula: If highest or 2nd highest result, return adjacent merged value

I'm looking to return the results of an adjacent (column E) based on whether or not the value in another column (column F) is the highest value or 2nd highest value, not ignoring duplicates. Here's a sample data set:

    B               C               D                E               F          
   -------------------------------------------------------------------------------
 5| PRICING MODELS  X               X                X               SCORE
 6| Free            X               X                X               35
 7| Developer Pays  Pay As You Go   X                X               22
 8| X               Tiered          Subscription     X               0
 9| X               X               Usage            One-Time        22
10| X               X               X                Recurring       0

Column E (the column I'd like returned) is merged (starting at column B) depending on the row. An X either below or to the right indicates that the cell is merged with the value above or to the left, respectively.

As I have 5 rows of values in this sample, this is what I'd like returned:

    G                       
   -----------------------------------------
27| Free
28| Pay As You Go
29| One-Time
30| No other pricing model is recommended
31| No other pricing model is recommended

Free is the highest value at 35, Pay As You Go and One-Time are tied for 2nd highest value at 22 (returned in hierarchy order), and Subscription and Recurring are both 0, so "No other pricing model is recommended" is returned.

My IF statement logic is:

  1. If one or more values in F6:F25 say "Incomplete questionnaire", return "Please complete the questionnaire", else
  2. Check for the highest value/2nd highest value in F6:F25. If 0, return "No other pricing model is recommended", else
  3. Return the value in column E adjacent to the highest value/2nd highest value in F6:F25.

Here are the formulas I've created for the highest value and 2nd highest value, respectively:

=IF(COUNTIF($F$6:$F$25,"Incomplete questionnaire"),"Please complete the questionnaire",IF((MAX($F$6:$F$25)=0),"No other pricing model is recommended",INDEX($E$6:$E$25,MATCH(MAX($F$6:$F$25),$F$6:$F$25,0))))

=IF(COUNTIF($F$6:$F$25,"Incomplete questionnaire"),"Please complete the questionnaire",IF((MAX($F$6:$F$25)=0),"No other pricing model is recommended",INDEX($E$6:$E$25,MATCH(LARGE($F$6:$F$25,2),$F$6:$F$25,0))))

All is working except for #3 where the adjacent value is returned. Is it possible to return the adjacent value in column E if the same column is potentially merged?

Thanks everyone, and let me know of any ideas.

Aucun commentaire:

Enregistrer un commentaire