+ Reply to Thread
Results 1 to 8 of 8

Populate Cell Based on IF

  1. #1
    Registered User
    Join Date
    07-06-2008
    Location
    Chicago
    Posts
    18

    Populate Cell Based on IF

    I am using the following formula...

    =IF(Sheet1!B7="Tom",Sheet1!B4,0)

    I would like to add... OR Sheet1!B5="Tom"

    To summarize, if the text in cells Sheet1!B5, Sheet1!B6 or Sheet1! B7 = Tom, then copy Sheet1!B4

    How do I add OR and how many OR's can I use?

    Thank You.
    Last edited by VBA Noob; 07-15-2008 at 02:17 AM.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    Maybe =IF(or( Sheet1!B5:B7="Tom"), Sheet1!B4, 0)

    This is an array formula, meaning it MUST be confirmed with Ctrl+Shift+Enter, not just Enter. (With the cursor in the formula bar, hold down Ctrl and Shift, then press Enter.) You'll know you did it correctly if curly braces appear around the formula in the Formula Bar; you cannot type in the braces directly.

  3. #3
    Registered User
    Join Date
    07-06-2008
    Location
    Chicago
    Posts
    18

    Populate Cell Based on IF

    WHen I enter that formula it seems to want B5, B6 AND B7 to =TOM,
    rather than B5, B6 OR B7

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    Change the OR to AND.

  5. #5
    Registered User
    Join Date
    07-06-2008
    Location
    Chicago
    Posts
    18

    Populate Cell Based on IF

    Ctrl+Shift+Enter was the missing link.
    Thank You.

  6. #6
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    You're welcome.

    Array formulas are a whole new world, but they can be very slow to calculate. Use only as necessary.

  7. #7
    Registered User
    Join Date
    07-06-2008
    Location
    Chicago
    Posts
    18

    Populate Cell Based on IF

    Are there other options rather than using array formuals then? I will probably use more of that same type of formula while creating this series of workbooks.

  8. #8
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582
    To go back to your original question, the OR function (and the AND function) starts with the OR and then all the arguments in parenthesis
    Please Login or Register  to view this content.
    Excel allows up to 30 arguments.

    ChemistB

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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