+ Reply to Thread
Results 1 to 9 of 9

"IF" statement, 2 in 1 cell or combined

  1. #1
    Registered User
    Join Date
    04-29-2007
    Posts
    10

    "IF" statement, 2 in 1 cell or combined

    I have the following statement in cell E8:

    =IF(A1=1,"ON","") So if A1 has 1 in it then E8 displays ON otherwise nothing

    I would Also like to add the following to E8:

    =IF(A1=0,"","OFF") So if A1 has 0 in it then E8 displays OFF otherwise nothing

    How do u add two "IF" statements to one cell? Or is it possible to combine the above two. 1=ON, 0=OFF, Empyty = Empty

    Thanks

  2. #2
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,444
    =if(a1=1,"on",if(a1=0,"off",""))

    ie make the second if the negative outcome of the first
    Rule 1: Never merge cells
    Rule 2: See rule 1

    "Tomorrow I'm going to be famous. All I need is a tennis racket and a hat".

  3. #3
    Registered User
    Join Date
    04-29-2007
    Posts
    10
    Quote Originally Posted by sweep
    =if(a1=1,"on",if(a1=0,"off",""))

    ie make the second if the negative outcome of the first
    I tried that its works for 1 and 0 but if A1 is empty still displays "off" and i need the target cell to display empty if a1 is empty also I tried:

    =IF(A1=1,"on",IF(A1=0,"off", IF(A1<>"","")))

    but same prob as above.

  4. #4
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,444
    A third if then!!!

    =IF(A1<>"",IF(A1=1,"on",IF(A1=0,"off","")),"")

  5. #5
    Registered User
    Join Date
    04-29-2007
    Posts
    10
    Quote Originally Posted by sweep
    A third if then!!!

    =IF(A1<>"",IF(A1=1,"on",IF(A1=0,"off","")),"")
    woot that works thank you, I started messing with a nested OR statement but couldnt figure that out.

  6. #6
    Registered User
    Join Date
    11-08-2013
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: "IF" statement, 2 in 1 cell or combined

    Hi,

    want ot combine two if condition how do i do?

    if value is less than one then +1 or if value is greater than or equal to 1 then value remain same. Conditions are =IF(A27<1,A27+1),IF(A27>=1,A27)

  7. #7
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: "IF" statement, 2 in 1 cell or combined

    Quote Originally Posted by Rohit47 View Post
    Hi,

    want ot combine two if condition how do i do?

    if value is less than one then +1 or if value is greater than or equal to 1 then value remain same. Conditions are =IF(A27<1,A27+1),IF(A27>=1,A27)

    Start a new thread.
    let Source = #table({"Question","Thread", "User"},{{"Answered","Mark Solved", "Add Reputation"}}) in Source

    If I give you Power Query (Get & Transform Data) code, and you don't know what to do with it, then CLICK HERE

    Walking the tightrope between genius and eejit...

  8. #8
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: "IF" statement, 2 in 1 cell or combined

    Hi, Rohit47,

    Unfortunately your post does not comply with Rule 2 of our Forum RULES. Do not post a question in the thread of another member -- start your own thread.

    If you feel an existing thread is particularly relevant to your need, provide a link to the other thread in your new thread.

    Old threads are often only monitored by the original participants. New threads not only open you up to all possible participants again, they typically get faster response, too.

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  9. #9
    Registered User
    Join Date
    11-08-2013
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: "IF" statement, 2 in 1 cell or combined

    1 =IF(A25>=1,A25) answ is 1
    1.1 =IF(A25>=1,A25) ans 1.1
    0.45 =IF(A27<1,A27+1) ans is 1.45 i.e correct

    in above cell ref two different condition is there i just want to get this two condition combine.
    it is possible or not?

+ 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