+ Reply to Thread
Results 1 to 17 of 17

would this be a nested IF?

  1. #1
    Forum Contributor
    Join Date
    02-16-2010
    Location
    Manchester, England
    MS-Off Ver
    Microsoft 365 for Enterprise
    Posts
    103

    would this be a nested IF?

    I have a column with 5 group names in, and another with territory names in and another one showing total space available, if it is one territory the space available is split across of the 5 groups but not equally, and if its the other territory the space is split across the 5 groups but again not equally.


    Territory One Territory Two
    Group One 32.666% 32.666%
    Group Two 32.666% 16.333%
    Group Three Leave Out 16.333%
    Group Four 16.333% 16.333%
    Group Five 16.333% 16.333%


    My column headers are:

    A B C D E F
    Site ID Ranked Group Territory Stock ID Total Space Available GROUP SPACE AVAILABLE


    It's column F I want to pupulate with a split of column E based on the above criteria, I just can't wrap my head around the exact logic and in what order to run it in.

    Any pointers would be greatly appreciated, have attached a sample file if that helps.

    Thanbks in advance!
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    02-16-2010
    Location
    Manchester, England
    MS-Off Ver
    Microsoft 365 for Enterprise
    Posts
    103

    Re: would this be a nested IF?

    Territory 1 Territory 2
    Group 1 32.67% 32.67%
    Group 2 32.67% 16.33%
    Group 3 Leave Out 16.33%
    Group 4 16.33% 16.33%
    Group 5 16.33% 16.33%

  3. #3
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,826

    Re: would this be a nested IF?

    I'm sure it could be done with a nested IF() function, but I would be more inclined to build a lookup table and use a 2D lookup function (see "lookup and reference functions here": https://support.office.com/en-us/art...rs=en-US&ad=US ).

    1) Build lookup table exactly like you have attempted in your post.
    2) A MATCH() function to find "group #" in the left most column of the lookup table. MATCH(B2,absolute_reference_to_left_column_of_lookup_table,0)
    3) A MATCH() function to find the "territory #" in the top row of the lookup table. MATCH(C2,absolute_reference_to_top_row_of_lookup_table,0)
    4) An INDEX() function using the main body of the lookup table and the results of 2 and 3 to extract the desired value. =INDEX(absolute_reference_to_body_of_lookup_table,result_of_step_2,result_of_step_3).
    5) Nest that inside of your "splitting" formula(s) to get the final result.

    That's how I'd probably do something like this. Will something like that work for you?
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  4. #4
    Forum Contributor
    Join Date
    02-16-2010
    Location
    Manchester, England
    MS-Off Ver
    Microsoft 365 for Enterprise
    Posts
    103

    Re: would this be a nested IF?

    Thanks for your input but I fear that may be too many steps.

    This is for an activity I'm handing over and will have to be repeated after I leave so I'm trying to find a single column solution if there is one for the sake of leaving a simple-ish instructioned template for my successsor

  5. #5
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,826

    Re: would this be a nested IF?

    If that is your concern, remember that MATCH() functions can easily be nested inside of INDEX() functions =restofsplitfunction*INDEX(body of table, MATCH(group #,left column,0),MATCH(terr #,top row,0)) (assuming multiplication is the correct operation).

  6. #6
    Forum Contributor
    Join Date
    02-16-2010
    Location
    Manchester, England
    MS-Off Ver
    Microsoft 365 for Enterprise
    Posts
    103

    Re: would this be a nested IF?

    How would that read, if I wanted the nested Match Index function in the GROUP SPACE AVAILABLE column [F]

    if in the s/sheet RANKED GROUP is column [B], TERRITORY Column [B] and TOTAL SPACE AVAILABLE is column [E}

    and the lookup Table, say called TABLE, looks like this, but in an actual table:

    [RANKED GROUP ] [ TERRITORY1 ] [ TERRITORY 2 ]
    [Group 1 ] [ 32.666% ] [ 32.666% ]
    [Group 2 ] [ 32.666% ] [ 16.333% ]
    [Group 3 ] [ 0.000% ] [ 16.333% ]
    [Group 4 ] [ 16.333% ] [ 16.333% ]
    [Group 5 ] [ 16.333% ] [ 16.333% ]

  7. #7
    Forum Contributor
    Join Date
    02-16-2010
    Location
    Manchester, England
    MS-Off Ver
    Microsoft 365 for Enterprise
    Posts
    103

    Re: would this be a nested IF?

    TERRITORY = column [C]

    been bending my head around this rule a while now, sorry for the simple mistakes!

  8. #8
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,826

    Re: would this be a nested IF?

    I don't use named ranges/tables much, so I am not exactly sure how it would look where you name the entire lookup table. If you have three separate named ranges:
    Group_col that refers to the leftmost "group #" column of the lookup table (not including the first row of that column). For example, maybe this is M3:M8.
    Terr_row that refers to the top row of the lookup table (not including the first column of that row). For example, maybe this is N2:O2.
    lookup_body that refers to the main body of the table (not including the first row or first column -- just the block of return values). For example, this might be N3:O8

    The lookup function might look like =INDEX(lookup_body,MATCH(B2,Group_col,0),MATCH(C2,Terr_row,0))
    or, without the named ranges =INDEX($N$3:$O$8,MATCH(B2,$M$3:$M$8,0),MATCH(C2,$N$2:$O$2,0))

  9. #9
    Forum Contributor
    Join Date
    02-16-2010
    Location
    Manchester, England
    MS-Off Ver
    Microsoft 365 for Enterprise
    Posts
    103

    Re: would this be a nested IF?

    Fantastic, thanks for your help, now to do some research about the lookup table and referencing

    thanks again

  10. #10
    Forum Contributor
    Join Date
    02-16-2010
    Location
    Manchester, England
    MS-Off Ver
    Microsoft 365 for Enterprise
    Posts
    103

    Re: would this be a nested IF?

    I can't quite get my head round the lookup table part of that and as i' leaving it in a template (tomorrow when I finish, yikes!) i'm trying desperately to build a single cell solution so have gone back to the board hoping to find if this condition mix can be done with a nested IF AND OR statement or mix thereof,

    thanks again for your input, I am still trying to get your version running in parallel, i'll keep you posted!

  11. #11
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,826

    Re: would this be a nested IF?

    I'm not sure what trouble you are having with the lookup table. Here's what I had in mind. You could easily hide the columns with the lookup table or move the lookup table (L3:N9) to its own tab, maybe even hide that tab, whatever you feel you need to do. Also note that I did not know the full calculation you wanted in column F, so I just did the lookup.
    Attached Files Attached Files

  12. #12
    Forum Contributor
    Join Date
    02-16-2010
    Location
    Manchester, England
    MS-Off Ver
    Microsoft 365 for Enterprise
    Posts
    103

    Re: would this be a nested IF?

    The outcome grid I posted above is the outcome percentage of column E, Total Space Available, so the outcome i'm trying to get is if the above conditions are met then the outcome is the corresponding row column of Column E (Total Space Available) * relevant percentage, ), 1/6 or 1/3 rd of total space available

  13. #13
    Forum Contributor
    Join Date
    02-16-2010
    Location
    Manchester, England
    MS-Off Ver
    Microsoft 365 for Enterprise
    Posts
    103

    Re: would this be a nested IF?

    This is the outcome i'm looking for based on the 10 variables across the 2 criteria fields, I don't think i'm quite asking right

    GROUP TERRITORY OUTCOME
    Group1 Territory1 CellRef x 2
    Group2 Territory1 CellRef x 2
    Group3 Territory1 CellRef x 0
    Group4 Territory1 CellRef x 1
    Group5 Territory1 CellRef x 1
    Group1 Territory2 CellRef x 2
    Group2 Territory2 CellRef x 1
    Group3 Territory2 CellRef x 1
    Group4 Territory2 CellRef x 1
    Group5 Territory2 CellRef x 1



    is the above matrix of 10 possibilities with 3 potential outcomes possible with a nested IF AND OR function at all?

  14. #14
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,826

    Re: would this be a nested IF?

    Now I think I am completely confused.
    then the outcome is the corresponding row column of Column E (Total Space Available) * relevant percentage, ), 1/6 or 1/3 rd of total space available
    This sound like column F should be as simple as multiplying the current formula in F by E. =E2*INDEX($M$4:$N$9,MATCH(B2,$L$4:$L$9,0),MATCH(C2,$M$3:$N$3,0)). However, in post 13, you use 0, 1, or 2 as the multiplier, and I don't know where the 0, 1, or 2 came from (unless they just represent the ratio of those percentages 0/6, 1/6, 2/6).

    As I said, I expect it is possible with a long nested IF() function, but I thought that this lookup table approach would be easier than a long nested IF().

  15. #15
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,036

    Re: would this be a nested IF?

    Try this in F2, copied down:

    =IFERROR(E2/IF(C2="Terr 1",LOOKUP(1000, SEARCH({"One","Two","Three","Four","Five","Six"},B2),{3,3,0,6,6,0}),IF(C2="Terr 2",LOOKUP(1000,SEARCH({"One","Two","Three","Four","Five","Six"},B2),{3,6,6,6,6,0}),"")),0)
    Attached Files Attached Files
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  16. #16
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,036

    Re: would this be a nested IF?

    Just noticed that you are using Excel 2003...

    =IF(B2="","",E2/IF(C2="Terr 1",LOOKUP(1000,SEARCH({"One","Two","Three","Four","Five","Six"},B2),{3,3,0,6,6,0}),IF(C2="Terr 2",LOOKUP(1000,SEARCH({"One","Two","Three","Four","Five","Six"},B2),{3,6,6,6,6,0}),"")))
    Attached Files Attached Files

  17. #17
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: would this be a nested IF?

    or
    F2=IF(B2="","",E2/SUMPRODUCT(({"One","Two","Three","Four","Five","Six"}=B2)*IF(C2="Terr 1",{3,3,0,6,6,0},{3,6,6,6,6,0})))
    Try this and copy towards down
    Samba

    Say thanks to those who have helped you by clicking Add Reputation star.

+ 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. Trying to Convert Excel nested IF to Access nested IIF
    By bbeards in forum Access Tables & Databases
    Replies: 5
    Last Post: 10-10-2018, 10:33 PM
  2. [SOLVED] Nested IF and nested Concatenation formula
    By VisionSmart in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 10-09-2018, 08:00 AM
  3. [SOLVED] Nested vlookup or nested IFAND function?
    By jeptik in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-11-2017, 02:27 AM
  4. Easier Way To Decipher Nested Nested IF's
    By Vladamir in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-06-2015, 03:37 PM
  5. [SOLVED] Nested Sumif's or how to sum data based on nested criteria
    By dlietz in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 10-07-2014, 11:36 AM
  6. How to reduces Nested IF code(144 Nested IF) to achive same functionality
    By jobseeker in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-09-2014, 09:45 AM
  7. help on a nested countif/nested if formula
    By vickiemc in forum Excel General
    Replies: 2
    Last Post: 08-13-2008, 08:29 AM

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