+ Reply to Thread
Results 1 to 7 of 7

Adding a second condition to an existing formula

  1. #1
    Registered User
    Join Date
    03-15-2011
    Location
    Iowa City, IA
    MS-Off Ver
    Excel 2013
    Posts
    29

    Unhappy Adding a second condition to an existing formula

    Hello all,

    I have a file that has a master list of staff. From the master list I have created multiple tabs that subsets the master list into teams of staff depending on their team membership. For example, the master list will have staff name and then team as seen in the list below and then I have tab (Ad) and tab (Sales). I use a formula (see below) to pull that name into the correct tab (Sales or Ad, etc). The condition is always team membership. Now I need to create another condition – if contract = Yes. I tried an IFS and then adding ‘Master list'!$C$1:$C$500="Yes", but that didn’t work. How do I modify the formula below to pullover the appropriate name based on two conditions?

    Name Team Contract
    Frank Holzt Ad No
    Miriam Turner Sales Yes


    =IF(ISERROR(INDEX('Master list'!$A$1:$D$500,SMALL(IF('Master list'!$B$1:$B$500="Sales", ROW('Master list'!$B$1:$B$500)),ROW(1:1)),2)),"",INDEX('Master list'!$A$1:$D$500,SMALL(IF('Master list'!$B$1:$B$500="Sales", ROW('Master list'!$B$1:$B$500)),ROW(1:1)),1))

    Thanks for your help.

    Zeda

  2. #2
    Registered User
    Join Date
    06-15-2016
    Location
    here, there
    MS-Off Ver
    2010
    Posts
    59

    Re: Adding a second condition to an existing formula

    have you tried the AND formula? example IF(AND(A1=1,B2=1),C1=1,C1=2) this is how too do both. there is also an OR formula that can work in place of the AND formula.

  3. #3
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Adding a second condition to an existing formula

    What type of data does the formula return? Is it text? Numbers? Could be both? Something else?
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  4. #4
    Registered User
    Join Date
    03-15-2011
    Location
    Iowa City, IA
    MS-Off Ver
    Excel 2013
    Posts
    29

    Re: Adding a second condition to an existing formula

    Quote Originally Posted by Tony Valko View Post
    What type of data does the formula return? Is it text? Numbers? Could be both? Something else?
    Mr. Valko,

    It returns either, it depends on the cell it is referencing.

    Zeda

  5. #5
    Registered User
    Join Date
    03-15-2011
    Location
    Iowa City, IA
    MS-Off Ver
    Excel 2013
    Posts
    29

    Re: Adding a second condition to an existing formula

    Quote Originally Posted by crushdrinker06 View Post
    have you tried the AND formula? example IF(AND(A1=1,B2=1),C1=1,C1=2) this is how too do both. there is also an OR formula that can work in place of the AND formula.
    Crushdrinker06:

    I never thought of the AND formula. I tried it and it works well. I can narrow down more specifically which staff I'm pulling into the specific team tabs. I believe I can also use the OR. This makes a lot of sense.

    Thanks to both your and Mr. Valko for your help.

    Zeda

  6. #6
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Adding a second condition to an existing formula

    =IF(ISERROR(INDEX('Master list'!$A$1:$D$500,SMALL(IF('Master list'!$B$1:$B$500="Sales", ROW('Master list'!$B$1:$B$500)),ROW(1:1)),2)),"",INDEX('Master list'!$A$1:$D$500,SMALL(IF('Master list'!$B$1:$B$500="Sales", ROW('Master list'!$B$1:$B$500)),ROW(1:1)),1))
    I'm a bit confused by your formula.

    The error trap portion is testing column 2 but the value_if_false portion is testing column 1.


  7. #7
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Adding a second condition to an existing formula

    Here's an example of what you want to do based on using Excel 2003.

    We want to extract data from column A where column B = X AND column C = X.

    Data Range
    A
    B
    C
    D
    E
    1
    Header1
    Header2
    Header3
    ------
    Header4
    2
    Data1
    X
    C
    Data3
    3
    Data2
    C
    X
    Data8
    4
    Data3
    X
    X
    5
    Data4
    D
    X
    6
    Data5
    X
    C
    7
    Data6
    S
    X
    8
    Data7
    A
    C
    9
    Data8
    X
    X
    10
    Data9
    X
    D


    This array formula** entered in E2:

    =IF(ISERROR(SMALL(IF((B$2:B$10="X")*(C$2:C$10="X"),ROW(A$2:A$10)),ROWS(E$2:E2))),"",INDEX(A:A,SMALL(IF((B$2:B$10="X")*(C$2:C$10="X"),ROW(A$2:A$10)),ROWS(E$2:E2))))

    ** array formulas need to be entered using the key
    combination of CTRL,SHIFT,ENTER (not just ENTER).
    Hold down both the CTRL key and the SHIFT key
    then hit ENTER.

    Copy down until you get blanks.

+ 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: 3
    Last Post: 01-13-2016, 12:05 PM
  2. Additional condition to existing formula
    By pauldaddyadams in forum Excel General
    Replies: 2
    Last Post: 04-09-2015, 08:44 AM
  3. [SOLVED] Adding a "not to exceed" condition to existing formula
    By RandomRed in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 03-11-2014, 10:55 AM
  4. Need help in adding the IF condition in existing Formula
    By Manish_Gupta in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 11-08-2013, 01:00 AM
  5. Adding an IF condition into an existing formula.
    By dmejia174 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-06-2013, 07:33 PM
  6. [SOLVED] How to add another IF condition in an existing formula. Please help
    By dmejia174 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 08-06-2013, 06:04 PM
  7. Adding condition to existing formula
    By KINNEY0201 in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 09-16-2010, 01:42 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