+ Reply to Thread
Results 1 to 10 of 10

IF function

  1. #1
    Registered User
    Join Date
    12-06-2009
    Location
    Monroe, Louisiana
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    31

    IF function

    I am trying to use the IF function to make a cell display one of two text strings. I have cells L3 L4 & L5 tagged as Credit and P3 through P8 tagged as Debit. In cell A10 the Data Validation is "List" using the above cells as the source. What I want to do, is when I choose from the drop down list in cell A10, I want Cell D10 to display either "Income" or "Expense". A credit will be income, while a debit will be expense. I can make this work using only half of the formula, but I can't seem to combine two IF formulas. Here is the formula that works: =IF(A10="Credit","","Income"). Should I be using another funtion other than IF?

    Thank you in advance for your help!
    Last edited by MattVarnell; 12-06-2009 at 06:49 PM.

  2. #2
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: IF function help

    since you only have 2 options why not =IF(A10="Credit","Income","expense").
    if blank is also an option then
    if(a10="","",IF(A10="Credit","Income","expense"))
    Last edited by martindwilson; 12-06-2009 at 10:29 AM.
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  3. #3
    Forum Contributor
    Join Date
    12-02-2009
    Location
    Akron, Ohio
    MS-Off Ver
    Excel 2010
    Posts
    208

    Re: IF function help

    The IF statement Format: Result=IF(test,Then,Else)

    So, with this in mind you can replace the "Else" part with a new "IF" up to seven times.

    IF( condition1, value_if_true1, IF( condition2, value_if_true2, value_if_false2 ))

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    12-06-2009
    Location
    Monroe, Louisiana
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    31

    Re: IF function help

    I have tried that formula, and just to make sure I tried it again. No matter what you choose in A10, the result in D10 refers to the "value_if_false" text, which in this case is "Expense". If you reverse the true and false values, it always reverts to the false value.

  5. #5
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: IF function help

    make sure the dropdown text is exactly the same as the text in formula
    check =length(a10) =6 for credit there may be a space at the end
    or try
    =IF(TRIM(A10)="Credit","Income","expense")

  6. #6
    Registered User
    Join Date
    12-06-2009
    Location
    Monroe, Louisiana
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    31

    Re: IF function help

    Quote Originally Posted by jrdnoland View Post
    The IF statement Format: Result=IF(test,Then,Else)

    So, with this in mind you can replace the "Else" part with a new "IF" up to seven times.

    IF( condition1, value_if_true1, IF( condition2, value_if_true2, value_if_false2 ))

    Please Login or Register  to view this content.
    I tried this, but the cell remains blank. Let me try to be more specific. In cells L4 and L5 I have AD and D respectively. These two cells are taggedas credit. In cells P4 through P8 I have AP, ATM, DC, FT, and SC tagged as Debit. When I click on cell A10 a list drops down displaying all of the above codes. If I were to choose either AD or D I want cell D10 to display Credit, and if I choose AP, ATM, DC, FT, or SC I want cell D10 to display Debit.

  7. #7
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: IF function help

    =IF(OR(A10={"ad","d"}),"credit","debit")

  8. #8
    Forum Contributor
    Join Date
    12-02-2009
    Location
    Akron, Ohio
    MS-Off Ver
    Excel 2010
    Posts
    208

    Re: IF function help

    Matt - I would follow what Martin is suggesting, my only other input would be that you need to also be aware of case sensitivity.

    If you still can't get it to work, you can attach the worksheet.

  9. #9
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: IF function help

    case sensitivity.
    in simple conditions like this, Excel ignores case

    ="Hello World"="hELLO wORLD"

    evaluates to TRUE.

    AFAIK, only FIND(), EXACT() and the arguments for CONVERT() are case sensitive.

  10. #10
    Registered User
    Join Date
    12-06-2009
    Location
    Monroe, Louisiana
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    31

    Re: IF function help

    That Did It!!! Thank You Guys so much for your help!!!

+ 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