+ Reply to Thread
Results 1 to 11 of 11

clustered if else combination

  1. #1
    Registered User
    Join Date
    08-27-2012
    Location
    chennai
    MS-Off Ver
    Excel 2007
    Posts
    48

    clustered if else combination

    Hi,

    I have a requirement for this complex nested loop. Would be great if I get a solution for this.

    Column A and Column B has values ranging between 1 - 35 in both the columns. Based on these conditions I need the value to be printed in C.

    Both A and B should be between the Range of 31-35 then the output should be 7
    Any one of the column should be 31-35 and other column should be in 26-30 then the output should be 6
    Both A and B should be between the Range of 26-30 then the output should be 5
    Any one of theColumn should be between 26-30 and other column should be between 21-25 then the output should be 4
    Any one of the column should be between 31-35 and other column is below 20 then the output should be 3
    Any one of the column should be between 21-25 and other column is below 20 then the output should be 2
    Both the columns are below 20. then the output should be 1

    it will ideally have 35*35 combinations. but I have attached a same with limited combinations. Pls refer sample.xlsx

    Thanks in advance
    Attached Files Attached Files
    Last edited by saidineshbabu; 12-12-2020 at 01:14 AM.

  2. #2
    Forum Expert
    Join Date
    09-07-2014
    Location
    Israel
    MS-Off Ver
    office 365
    Posts
    3,187

    Re: clustered if else combination

    Fast answers need clear examples. Post a small Excel sheet (not a picture) showing realistic & representative sample data WITHOUT confidential information (10-20 rows, not thousands...) and some manually calculated results. Just before posting, scroll down to GO ADVANCED, click, and then scroll down to MANAGE ATTACHMENTS and click again. Now follow the instructions at the top of that screen.

  3. #3
    Registered User
    Join Date
    08-27-2012
    Location
    chennai
    MS-Off Ver
    Excel 2007
    Posts
    48

    Re: clustered if else combination

    Sure @belinda200
    Attached the sample excel.

  4. #4
    Forum Expert
    Join Date
    09-07-2014
    Location
    Israel
    MS-Off Ver
    office 365
    Posts
    3,187

    Re: clustered if else combination

    Quote Originally Posted by saidineshbabu View Post
    Any one of the column should be 31-35 and other column should be in 26-30 then the output should be 6
    according to that- why would 30 and 30 in line 43 for example result in 6 ?
    are you sure about the values you inserted manually in your file?

  5. #5
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    Win10/MSO2016
    Posts
    12,994

    Re: clustered if else combination

    You need a helper column for each test condition:
    D2, a, b> 30
    Please Login or Register  to view this content.
    E2, 26>=a&b<=30
    Please Login or Register  to view this content.
    F2, a&b<20
    Please Login or Register  to view this content.
    G2, a|b>30, 20>=b|a<=30
    Please Login or Register  to view this content.
    Results in C2:
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Ben Van Johnson

  6. #6
    Registered User
    Join Date
    08-27-2012
    Location
    chennai
    MS-Off Ver
    Excel 2007
    Posts
    48

    Re: clustered if else combination

    Quote Originally Posted by belinda200 View Post
    according to that- why would 30 and 30 in line 43 for example result in 6 ?
    are you sure about the values you inserted manually in your file?
    sorry my bad. Updated the excel sheet to reflect correctly.

  7. #7
    Registered User
    Join Date
    08-27-2012
    Location
    chennai
    MS-Off Ver
    Excel 2007
    Posts
    48

    Re: clustered if else combination

    Thanks protonLeah.

    But the resutls are emply in few cells though the condition is met. Can you pls help?

  8. #8
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,222

    Re: clustered if else combination

    Please set table as in F1:J5
    then
    C2
    =VLOOKUP(A2,$F$2:$J$5,MATCH(B2,$F$1:$J$1))
    Attached Files Attached Files

  9. #9
    Forum Expert
    Join Date
    09-07-2014
    Location
    Israel
    MS-Off Ver
    office 365
    Posts
    3,187

    Re: clustered if else combination

    Hi,
    Without helper this would be the formula in D2 and down:

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by Limor_OP; 12-12-2020 at 06:24 AM.

  10. #10
    Registered User
    Join Date
    08-27-2012
    Location
    chennai
    MS-Off Ver
    Excel 2007
    Posts
    48

    Re: clustered if else combination

    Quote Originally Posted by Bo_Ry View Post
    Please set table as in F1:J5
    then
    C2
    =VLOOKUP(A2,$F$2:$J$5,MATCH(B2,$F$1:$J$1))
    This worked too. thanks!

  11. #11
    Registered User
    Join Date
    08-27-2012
    Location
    chennai
    MS-Off Ver
    Excel 2007
    Posts
    48

    Re: clustered if else combination

    Quote Originally Posted by belinda200 View Post
    Hi,
    Without helper this would be the formula in D2 and down:

    Please Login or Register  to view this content.
    This worked too. Thanks!

+ 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. [SOLVED] How to make the combination of numbers and total of that combination should be in range?
    By Darshan Shah in forum Excel Programming / VBA / Macros
    Replies: 38
    Last Post: 06-20-2020, 01:20 PM
  2. [SOLVED] how many cell in a row that contain certain combination from a larger combination
    By system in forum Excel Formulas & Functions
    Replies: 18
    Last Post: 11-17-2012, 03:04 PM
  3. How to : Clustered and Stacked Chart Combination
    By superkid in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 03-19-2009, 05:50 AM
  4. how to create a clustered, 100% stacked combination chart
    By Keri in Vermont in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 06-03-2006, 01:40 PM
  5. Combination Clustered and stacked needed
    By bigmn68 in forum Excel Charting & Pivots
    Replies: 3
    Last Post: 05-18-2006, 02:10 AM
  6. [SOLVED] combination clustered column and stacked bar chart
    By John in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 04-19-2005, 11:06 AM
  7. combination of stacked and clustered column
    By Grigori Margolin in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 01-23-2005, 04:06 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