+ Reply to Thread
Results 1 to 12 of 12

How to enter the value of the cell immediately above if that cell = 0

  1. #1
    Registered User
    Join Date
    01-19-2010
    Location
    Canberra, Australia
    MS-Off Ver
    Excel 2013
    Posts
    12

    Question How to enter the value of the cell immediately above if that cell = 0

    Hi
    I am in the last stages of setting up a spreadsheet which will help calculate scores in a game we play and need help with the following:

    If, within a column of random numbers (calculated elsewhere) there is a 0, what is the value of the number in the cell immediately above the 0, and if more than one 0 in the column, the greatest of these.

    I hope that makes sense.

    Cheers and thanks in advance
    Jan
    Last edited by blueshevy; 01-19-2010 at 04:56 AM. Reason: incorrect title

  2. #2
    Registered User
    Join Date
    01-19-2010
    Location
    Canberra, Australia
    MS-Off Ver
    Excel 2013
    Posts
    12

    Re: Help with (I think) IF Function

    Oh, I should add - I am using Excel 2000 (okay, I'm cheap and have an OLD computer )

  3. #3
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,645

    Re: Help with (I think) IF Function

    Hi blueshevy, can you please rename your title according to the rules:

    1. 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 the title of the thread, click EDIT on the original post, then click the Go Advanced button, then change the title. If two or more hours have passed, the EDIT button will not appear, and you need to ask a moderator to change the title.

  4. #4
    Registered User
    Join Date
    01-19-2010
    Location
    Canberra, Australia
    MS-Off Ver
    Excel 2013
    Posts
    12

    Re: Help with (I think) IF Function

    Quote Originally Posted by zbor View Post
    Hi blueshevy, can you please rename your title according to the rules:

    1. 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 the title of the thread, click EDIT on the original post, then click the Go Advanced button, then change the title. If two or more hours have passed, the EDIT button will not appear, and you need to ask a moderator to change the title.
    Thanks zbor - I hope that is better

  5. #5
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,645

    Re: How to enter the value of the cell immediately above if that cell = 0

    Here try this:

    Assume your data is in first row:

    =MAX(IF($A$1:$AZ$1=0,$B$1:$BA$1))

    comfirmed with ctrl+shift+enter

    (adjsut range to your data just notice that if data starting in A column and ending in X column you need to take one more in other range B to Y)

  6. #6
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: How to enter the value of the cell immediately above if that cell = 0

    If as implied the values are in a Column then you would adapt zbor's range accordingly such that you check for 0 from the 2nd row to the last and where 0 use the cell above before conducting the MAX, ie:

    Please Login or Register  to view this content.
    (you must start from 2nd row rather than first given if first row is 0 there is no row 0 to review...)

  7. #7
    Registered User
    Join Date
    01-19-2010
    Location
    Canberra, Australia
    MS-Off Ver
    Excel 2013
    Posts
    12

    Re: How to enter the value of the cell immediately above if that cell = 0

    okay, now I'm REALLY confused.

    Attached is a sample of what I am trying to do. What I would like my/your calculation to come up with is 486, i.e., the greatest number immediately preceeding a 0.

    Sorry to seem a bit dim, my brain is hurting - I have been trying to work this out for ages now. I am really a beginner at all this.

    Thanks heaps
    Jan
    Attached Files Attached Files

  8. #8
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: How to enter the value of the cell immediately above if that cell = 0

    You don't specify where you want the result, nor the significance (if any) of the values in C / blank line interspersed between groups of data, however in general terms

    Please Login or Register  to view this content.
    that in red is crucial - ie commit using the above keystrokes and not Enter as you would normally... this is an Array formula.

    the above is just an adapted version of my prior post (in itself an adaptation of zbor's) - ie altering the range references.

  9. #9
    Registered User
    Join Date
    01-19-2010
    Location
    Canberra, Australia
    MS-Off Ver
    Excel 2013
    Posts
    12

    Re: How to enter the value of the cell immediately above if that cell = 0

    OMG I think I love you!!!!

    Thanks so much guys, that is exactly what I was after. I think I will name my first born after you - no wait, too late! I will at the very least give you credit when all my people tell me how clever I am to come up with this.

    Cheers
    Jan

  10. #10
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,645

    Re: How to enter the value of the cell immediately above if that cell = 0

    What if there's no number (empty cell)... This formula treat is as 0...

  11. #11
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: How to enter the value of the cell immediately above if that cell = 0

    Either

    a) add an ISNUMBER test

    Please Login or Register  to view this content.
    b) use coercion to string

    Please Login or Register  to view this content.

  12. #12
    Registered User
    Join Date
    01-19-2010
    Location
    Canberra, Australia
    MS-Off Ver
    Excel 2013
    Posts
    12

    Re: How to enter the value of the cell immediately above if that cell = 0

    Actually guys I just changed the sheet so there was no empty rows. Much simpler.

    Thanks again

+ 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