+ Reply to Thread
Results 1 to 11 of 11

Complex If/Then Formula

  1. #1
    Registered User
    Join Date
    11-09-2015
    Location
    Florida
    MS-Off Ver
    O365
    Posts
    61

    Complex If/Then Formula

    Hi All:

    Need some help as this has my head spinning. Sample file attached with some notes on sheet 1. In a nutshell, I need to figure out the formula to say if a Code in Table 2 matches Table 1 (which can have duplicate values) and a second value of TYPE is Assigned or Additional, then return the highest value for a given month. There could be 3 possible values (0, .5 or 1).

    I'm prob making it more complicated than it needs to be with nested if/thens. I also was tinkering with MAX. All to no avail. I'm going to keep trying but thought I'd reach out for assistance.

    Thanks in advance for any guidance.

    Whh3
    Excel 2013
    Attached Files Attached Files

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: Complex If/Then Formula

    So where would this answer go, and could you give an example of what you expect?
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Registered User
    Join Date
    11-09-2015
    Location
    Florida
    MS-Off Ver
    O365
    Posts
    61

    Re: Complex If/Then Formula

    Thanks for the quick reply. In the sample workbook, Table 2 shows the expected values. In my real workbook, I would like to put the formulas in Table 2 b19:d26 in the example. Hope that makes sense.

    I basically have an existing table that looks similar to Table 2 (a few more columns involved) and would like each code to populate for each month based on a separate sheet of raw data which is represented by Table 1.

    Regards!

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: Complex If/Then Formula

    And the code could be repeated in Table 1 - and you want the highest value, correct?

  5. #5
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: Complex If/Then Formula

    If so, try this ARRAY formula in B19, copied across...
    =MAX(IF($A$3:$A$14=$A19,C$3:C$14))
    ...confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer.

  6. #6
    Registered User
    Join Date
    11-09-2015
    Location
    Florida
    MS-Off Ver
    O365
    Posts
    61

    Re: Complex If/Then Formula

    Yes, I can’t think of any reason returning the highes value wouldn’t work. Yes, I’d repeat the formula in table one for each row with a unique Code value.

  7. #7
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: Complex If/Then Formula

    Did you try my formula?

  8. #8
    Registered User
    Join Date
    11-09-2015
    Location
    Florida
    MS-Off Ver
    O365
    Posts
    61

    Re: Complex If/Then Formula

    I won’t be able to give that a try till tomorrow, however I hope it was really as simple as you showed. I figured I was overly complicating it. Will give it a shot in the morning.

    Do I have to use a range of cells or could I just use the column? Like [Code] or A:A? Over time the number of rows may increase. Thanks!

  9. #9
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: Complex If/Then Formula

    I added extra columns to compare against your sample anwers...
    A
    B
    C
    D
    E
    F
    G
    17
    Desired Outcome
    Table 2
    18
    Code
    Jan
    Feb
    Mar
    Jan2
    Feb3
    Mar4
    19
    C10
    1
    0
    1
    1
    0
    1
    20
    C222
    1
    0.5
    1
    1
    0.5
    1
    21
    P135
    0
    0
    1
    0
    0
    1
    22
    Po900
    1
    0.5
    0.5
    1
    0.5
    0.5
    23
    T26
    1
    0
    0
    1
    0
    0
    24
    T321
    1
    1
    1
    1
    1
    1
    25
    T404
    1
    1
    1
    1
    1
    1
    26
    T404 a
    0
    0
    1
    0
    0
    1

    E19 (which you would actually put in B10)
    =MAX(IF($A$3:$A$14=$A19,C$3:C$14))
    array entered
    then copy across as needed

    Yes, you could use full-column ref's but that could slow your file down.
    Rather, extend the range to 2-3 times what you think you might need...
    =MAX(IF($A$3:$A$10000=$A19,C$3:C$10000))

  10. #10
    Registered User
    Join Date
    11-09-2015
    Location
    Florida
    MS-Off Ver
    O365
    Posts
    61

    Re: Complex If/Then Formula

    FDibbins: I just tested it out on the test data and it indeed seems to do the trick! I think I was going down the wrong path with If/Then's when you hit the nail on the head. It really only needs to show the highest value for each match. I've never used max before and forgot about arrays. Thanks so much for your help! Marking this as "SOLVED."

  11. #11
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: Complex If/Then Formula

    Happy to help

+ 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. COMPLEX FORMULA PLEASE ? :s
    By joelabar in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-19-2017, 02:48 PM
  2. [SOLVED] Complex formula getting moer complex
    By Trebor777 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 05-02-2017, 01:39 PM
  3. [SOLVED] Use an existing cell formula for creating a new more complex formula
    By dubcap01 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-23-2014, 07:41 AM
  4. Replies: 4
    Last Post: 02-03-2014, 12:47 AM
  5. Assistance with reporting data inorder with no blank cells or rows inbetween
    By Ghost Of Casper in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-28-2013, 01:37 PM
  6. Complex Sum formula
    By hartski in forum Excel General
    Replies: 2
    Last Post: 11-19-2008, 12:08 PM
  7. Need Help with Complex??? Formula
    By sheppjr in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-12-2006, 12:34 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