+ Reply to Thread
Results 1 to 12 of 12

If statements with cell dependancies

Hybrid View

  1. #1
    ZIXILPLIX
    Guest

    If statements with cell dependancies

    Two questions:

    1) How do I make a cell (C1 for example) who's formula is "=A1-B1" show the difference of those two cells unless the answer is 0 in which case I want it to report "N/A"? In other words, if A1 is "10" and B1 "5", then C1 would report "5" but if A1 was "10" and B1 was "10" then C1 would report "N/A" and not "0."

    2) This one is more involved as it relys on the value of another cell but here goes: I need a formula that will pull a number from a cell two rows above it but depending on the text in the cell two rows below it I may need it to adjust that number accordingly. For clarification: Assume that cell B5 will always contain 1 of the following 3 text entries: DISTINCT, CAPTURED, or ASSUMED. Cell B1 will always contain a number to one decimal place (i.e. 7.2 or 55.6). I need a formula in cell B3 that pulls the number from B1 but alters it depending on the text in B5. If B5's text is "DISTINCT" I want B3 to show B1's value exactly without any alteration. But if B5's text is "CAPTURED or ASSUMED" I want B3 to show B1's value exactly UNLESS B1 is less than 44 in which case I want B3 to display the "44.0." So if B1 is "98.0" and B5 is either "CAPTURED" or "ASSUMED" than B3 should report "98.0" but if B5 is "17.9" with B5 still being either "CAPTURED" or "ASSUMED" then B3 would report "40.0."

    Any help would be greatly appreciated
    Last edited by ZIXILPLIX; 05-01-2010 at 09:21 AM.

  2. #2
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: Excel relatively simple (I think) if statments

    HI Z...

    Answer to Q1: =IF(A1-B1>0,A1-B1,"#NA")

    abousetta

  3. #3
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: Excel relatively simple (I think) if statments

    Hi again Z...

    Answer to Q2: =IF(B5="DISTINCT",B1,(IF(AND(OR(B5="CAPTURED",B5="ASSUMED"),B1>44),B1,44)))

    Do you need this as a macro also?

    Final point, just make sure that you format the cells as numbers with one decimal space.

    Good luck.

    Tell me if you need anything else.

    abousetta

  4. #4
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: Excel relatively simple (I think) if statments

    Hi Z,

    Just in case the cells are not B, but are the same distance as your description, just use this simple macro and it will add the same formula to the active cell.

    Sub Z()
    
    ActiveCell.FormulaR1C1 = _
            "=IF(R[2]C=""DISTINCT"",R[-2]C,(IF(AND(OR(R[2]C=""CAPTURED"",R[2]C=""ASSUMED""),R[-2]C>44),R[-2]C,44)))"        
    
    End Sub

    Good luck,

    abousetta

  5. #5
    ZIXILPLIX
    Guest

    Re: Excel relatively simple (I think) if statments

    Deleted (is there an option to actually delete these posts?)
    Last edited by ZIXILPLIX; 05-01-2010 at 09:25 AM.

  6. #6
    ZIXILPLIX
    Guest

    Re: Excel relatively simple (I think) if statments

    Thanks alot for the anwers abousetta!! Holy maceral!! You're a genius!!
    Last edited by ZIXILPLIX; 05-01-2010 at 09:24 AM.

  7. #7
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: Excel relatively simple (I think) if statments

    Hi ZIXILPLIX,

    Glad I could help. Anything from a friend from Tampa. Formulas are a really powerful way to use Excel. They are very flexible and allow you to an endless number of IFs.

    Good luck,

    abousetta

    P.S. If you are satisfied withthe response, don't forget to mark the thread as [Solved].

  8. #8
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Excel relatively simple (I think) if statments

    I apologise for being remiss in not stopping this thread sooner.

    Please take a few minutes to read the forum rules, and amending the thread title accordingly.

    Thanks.
    Entia non sunt multiplicanda sine necessitate

  9. #9
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Excel relatively simple (I think) if statments

    Thanks shg

    Your post does not comply with Rule 1 of our Forum RULES. Your post title should accurately and concisely describe your problem, not your anticipated solution. Use terms appropriate to a Google search. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will be addressed according to the OP's experience in the forum: If you have less than 10 posts, expect (and respond to) a request to change your thread title. If you have 10 or more posts, expect your post to be locked, so you can start a new thread with an appropriate title.
    To change a Title on your post, click EDIT then Go Advanced and change your title, if 2 days have passed ask a moderator to do it for you.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  10. #10
    ZIXILPLIX
    Guest

    Re: Excel relatively simple (I think) if statments

    Deleted...
    Last edited by ZIXILPLIX; 05-01-2010 at 09:26 AM.

  11. #11
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: Excel relatively simple (I think) if statments

    Hi Z,

    The title should reflect the problem that you are facing (e.g. Combining mulitple IF statements in a formula) or something similar to this. Something that can be searched for in Google or a similar search engine.

    As for marking the thread as solved, just go the first posting in the thread, click on EDIT then ADVANCED. Right next to the title you will find a drop-down menu with one of the options being [SOLVED]

    Good luck,

    abousetta

  12. #12
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Excel relatively simple (I think) if statments

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

    You can change the title at the same time

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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