+ Reply to Thread
Results 1 to 8 of 8

Formula to calculate if cell A* is the first non-blank, then...

  1. #1
    Registered User
    Join Date
    11-24-2011
    Location
    Montreal
    MS-Off Ver
    Excel 2003
    Posts
    4

    Formula to calculate if cell A* is the first non-blank, then...

    Hello,

    I was hoping somebody could help me with a formula...

    I have two columns A (where values may be entered) and B. I need a formula to enter in cells of column B that will return the following values:

    If the cell A* is the first non-blank cell in the range A1:A100 then return a value "X" in column B of the same row, if cell A* is not the first non-blank cell then return a value "Y", and if the cell A* is blank, return blank ("").

    Thanks in advance for your help!
    Last edited by galaxy_madness; 11-25-2011 at 04:31 PM.

  2. #2
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Formula to calculate if cell A* is the first non-blank, then...

    Try this formula in B1 copied down

    =IF(A1="","",IF(COUNTA(A$1:A1)=1,"x","y"))
    Audere est facere

  3. #3
    Forum Guru
    Join Date
    05-24-2011
    Location
    India
    MS-Off Ver
    Office 2021
    Posts
    2,237

    Re: Formula to calculate if cell A* is the first non-blank, then...

    deleted...
    Last edited by Haseeb Avarakkan; 11-24-2011 at 07:18 PM. Reason: Missunderstood OP's post
    Regards,
    Haseeb Avarakkan

    __________________________________
    "Feedback is the breakfast of champions"

  4. #4
    Registered User
    Join Date
    11-24-2011
    Location
    Montreal
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Formula to calculate if cell A* is the first non-blank, then...

    Quote Originally Posted by daddylonglegs View Post
    Try this formula in B1 copied down

    =IF(A1="","",IF(COUNTA(A$1:A1)=1,"x","y"))

    It doesn't seem to indentify the first entry in the range i.e. return "X", it returns "Y" for all non-blanks...

  5. #5
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Formula to calculate if cell A* is the first non-blank, then...

    It should work if the "blank" cells are truly blank - do they contain formulas?

    If so perhaps try this version instead

    =IF(A1="","",IF(COUNTIF(A$1:A1,"<>")=1,"x","y"))

  6. #6
    Registered User
    Join Date
    11-24-2011
    Location
    Montreal
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Formula to calculate if cell A* is the first non-blank, then...

    Quote Originally Posted by daddylonglegs View Post
    It should work if the "blank" cells are truly blank - do they contain formulas?

    If so perhaps try this version instead

    =IF(A1="","",IF(COUNTIF(A$1:A1,"<>")=1,"x","y"))
    This time it identifies the first entry as an "x" but when another is entered it swtiches "x" of the first entry for "y"...

    Any other suggestions?

    btw thanks for your help!

  7. #7
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Formula to calculate if cell A* is the first non-blank, then...

    When you say "first" - I was assuming you meant positionally? Do you or do you mean "first" chronologically, i.e. the first entry you make timewise?

    My suggestion works positionally, for example.....

    ....if you enter "apple" in A4 then B4 will display "x". If you then enter "banana" in A6 then B6 will show "y" (and B4 will still be "x"). Any further entries below A4 will be marked with a "y" too. If you enter a value in A3 now then that is now the first entry (positionally) so B3 will now be "x" and B4 will become "y".

    Is that how you would like it to work?

  8. #8
    Registered User
    Join Date
    11-24-2011
    Location
    Montreal
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Formula to calculate if cell A* is the first non-blank, then...

    Quote Originally Posted by daddylonglegs View Post
    When you say "first" - I was assuming you meant positionally? Do you or do you mean "first" chronologically, i.e. the first entry you make timewise?

    My suggestion works positionally, for example.....

    ....if you enter "apple" in A4 then B4 will display "x". If you then enter "banana" in A6 then B6 will show "y" (and B4 will still be "x"). Any further entries below A4 will be marked with a "y" too. If you enter a value in A3 now then that is now the first entry (positionally) so B3 will now be "x" and B4 will become "y".

    Is that how you would like it to work?
    My bad, it works perfectly, I must have done something wrong at first...

    Thanks a bunch, your help is much appreciated!

+ 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