+ Reply to Thread
Results 1 to 44 of 44

Reference a the first cell when.... (not sure how else to explain this)

  1. #1
    Registered User
    Join Date
    05-02-2014
    Location
    Can
    MS-Off Ver
    Excel 2003
    Posts
    23

    Question Reference a the first cell when.... (not sure how else to explain this)

    Sorry for the bad title. I'm a little lost but my image example should help clarify:

    I need a formula in Column C that will: (see image for example)
    1) Reference column A and display the value for the first number in that column only. Repeat that first number and ignore the other numbers until we get a number in column B.
    2) Reference column B and display the value for the first number in that column only. Repeat that first number and ignore the other numbers until we get a number in column A.

    EXAMPLE: (Attached image should explain it clearly)
    Excel Example.jpg

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Reference a the first cell when.... (not sure how else to explain this)

    This method works regardless of whether the first number appears in column A or B.

    Put this formula in C1:

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Then put this formula in C2, and copy down:

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    By the way, an image attachment has very little value. Just attach the Excel file. It's easier than taking a screenshot first and then attaching that. I could have just put these formulas into your file and reattached it.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    05-02-2014
    Location
    Can
    MS-Off Ver
    Excel 2003
    Posts
    23

    Re: Reference a the first cell when.... (not sure how else to explain this)

    6StringJazzer Your Great!! Thanks a tone.

    I made one small mistake. Your problem works perfect for the example I gave but if a cell happens to have a formula in it, instead of a blank cell, then I do not get the same result. This time I attached the file itself. I hope I get another quick reply. Thanks again. File attached:

    Excel Forum Question 2 - May2,14.xls

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,938

    Re: Reference a the first cell when.... (not sure how else to explain this)

    2 ways around this.

    Change the formula in column N to this...
    =IF(J24+K24=0,"",J24+K24)
    OR
    Change 6's formula to this...
    =IF(OR(AND(N24<>0,N23<>0),AND(M23<>"",M24<>"")),O23,IF(M24<>"",M24,N24))
    Last edited by FDibbins; 05-03-2014 at 04:27 PM.
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  5. #5
    Registered User
    Join Date
    05-02-2014
    Location
    Can
    MS-Off Ver
    Excel 2003
    Posts
    23

    Re: Reference a the first cell when.... (not sure how else to explain this)

    I have tried for hours to solve this last glitch. I hope your still willing to help as your great at this.

    Final Problem:
    Everything works great except in one scenario. If I have a ZERO in the last row of a column prior to switching to the other column, then I do not get the desired result. Instead of the new number being displayed in C, the same C value repeats. Again, the spread sheet is probably MUCH more clear than I can explain it. (Also I made quite a few changes as I did solve on other problem, with zero for a result, on my own. I just could not solve this one.)Excel Forum Question 3 - May2,14.xls

    THANKS A TONE!!

  6. #6
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,938

    Re: Reference a the first cell when.... (not sure how else to explain this)

    Ok try try this slightly different approach...
    =IF(OR(COUNT(K19:L20)=0,COUNT(M19:N20)=0),V19,IF(COUNT(K20:L20)=0,Q20,P20))
    copied down

  7. #7
    Registered User
    Join Date
    05-02-2014
    Location
    Can
    MS-Off Ver
    Excel 2003
    Posts
    23

    Re: Reference a the first cell when.... (not sure how else to explain this)

    What you come up with amazes me. Unfortunately the new approach won't work. The problem is that I only added those "K,L,M,N" columns as hypothetical examples to illustrate our first problem (that each cell has a formula of some kind in it). To create this formula I don't have K,L,M,N to work with. I hope I'm not out of luck now.
    Last edited by Mr_Fancy_Pants; 05-04-2014 at 05:25 PM.

  8. #8
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,938

    Re: Reference a the first cell when.... (not sure how else to explain this)

    Not exactly sure if you have those column references correct (D, E, F, G)?, but on the assumption that you meant you wont have the "A" and "B" columns (F/G or P/Q), then try this....
    =IF(OR(COUNT(K19:L20)=0,COUNT(M19:N20)=0),R19,IF(COUNT(K20:L20)=0,M20+N20,K20+L20))

  9. #9
    Registered User
    Join Date
    05-02-2014
    Location
    Can
    MS-Off Ver
    Excel 2003
    Posts
    23

    Re: Reference a the first cell when.... (not sure how else to explain this)

    Man your FAST! Check out the attachment. I greyed out the part we can't work with:
    Excel Forum Question 5 - May2,14.xls
    Attached Files Attached Files

  10. #10
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,938

    Re: Reference a the first cell when.... (not sure how else to explain this)

    ok, based in that....

    F
    G
    H
    20
    0
    4
    4
    21
    0
    0
    4
    22
    0
    0
    4
    23
    0
    2
    4
    24
    5
    0
    5


    How would I (or excel) know that H23 needs to still be 4, and not change to 2 - assuming that the data in A:D wont even be there?

    Or what am I missing here?

  11. #11
    Registered User
    Join Date
    05-02-2014
    Location
    Can
    MS-Off Ver
    Excel 2003
    Posts
    23

    Re: Reference a the first cell when.... (not sure how else to explain this)

    Well... hmmm... This is how I would verbally explain it.

    Column H always displays the first result in G until we get the first result in F and vice versa. Does this answer the question? The previous suggestions were super, super close with just a few glitches. Does this help?

  12. #12
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,938

    Re: Reference a the first cell when.... (not sure how else to explain this)

    Yup, thanks, I think I get it. Give me a few minutes

  13. #13
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,938

    Re: Reference a the first cell when.... (not sure how else to explain this)

    Is the "1" in K22 an error"

  14. #14
    Registered User
    Join Date
    05-02-2014
    Location
    Can
    MS-Off Ver
    Excel 2003
    Posts
    23

    Re: Reference a the first cell when.... (not sure how else to explain this)

    Yes kind of. More of a test. I was just trying different combinations to test the formula and I forgot to delete thatfinal. KLMN can be totally ignored as they were created simply to help make the final formula accurate.

  15. #15
    Registered User
    Join Date
    05-02-2014
    Location
    Can
    MS-Off Ver
    Excel 2003
    Posts
    23

    Re: Reference a the first cell when.... (not sure how else to explain this)

    I just want to use P&Q in the R column formula.

  16. #16
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,938

    Re: Reference a the first cell when.... (not sure how else to explain this)

    Whats wrong with the forumula that's already in H?

    =IF(OR(AND(G20=0,G19=0),AND(F19=0,F20=0)),H19,IF(F20+G20=0,H19,IF(F20=0,G20,F20)))

  17. #17
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,938

    Re: Reference a the first cell when.... (not sure how else to explain this)

    hmm I have been staring at this 1 for too long, I have asked for assistance from the other experts

  18. #18
    Registered User
    Join Date
    05-02-2014
    Location
    Can
    MS-Off Ver
    Excel 2003
    Posts
    23

    Re: Reference a the first cell when.... (not sure how else to explain this)

    Thank you. I hope someone can figure it out. I think it should be possible but I just don't have enough tools in my brain to fix it. Thanks for passing it on. I hope to hear something soon.

  19. #19
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,938

    Re: Reference a the first cell when.... (not sure how else to explain this)

    I am posting this here so I can continue later - it's still a work in progress. I am out of time right now, but will hopefully carry on on another PC later.
    Attached Files Attached Files

  20. #20
    Registered User
    Join Date
    05-02-2014
    Location
    Can
    MS-Off Ver
    Excel 2003
    Posts
    23

    Re: Reference a the first cell when.... (not sure how else to explain this)

    In the meantime can anyone help?

  21. #21
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Reference a the first cell when.... (not sure how else to explain this)

    Hello Mr_Fancy_Pants,

    Please see Sheet1 of the attached sample Workbook.

    Regards.
    Attached Files Attached Files
    Please consider:

    Be polite. Thank those who have helped you. Then Click on the star icon in the lower left part of the contributor's post and add Reputation. Cleaning up when you're done. If you are satisfied with the help you have received, then Please do Mark your thread [SOLVED] .

  22. #22
    Registered User
    Join Date
    05-02-2014
    Location
    Can
    MS-Off Ver
    Excel 2003
    Posts
    23

    Re: Reference a the first cell when.... (not sure how else to explain this)

    Quote Originally Posted by Winon View Post
    Hello Mr_Fancy_Pants,

    Please see Sheet1 of the attached sample Workbook.

    Regards.

    Please see my SHEET 2 of the attached sample workbook. Let me know if this is not clear.

    Excel Forum Question 6 - May2,14.xls

  23. #23
    Registered User
    Join Date
    05-02-2014
    Location
    Can
    MS-Off Ver
    Excel 2003
    Posts
    23

    Re: Reference a the first cell when.... (not sure how else to explain this)

    While I wait for a few that may not be online for a while, can anyone else help here? My last example should be very clear.

  24. #24
    Registered User
    Join Date
    05-02-2014
    Location
    Can
    MS-Off Ver
    Excel 2003
    Posts
    23

    Re: Reference a the first cell when.... (not sure how else to explain this)

    Can anyone help with my formula request? I hate to start over in another forum. I'm hoping we can solve this here.

  25. #25
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,938

    Re: Reference a the first cell when.... (not sure how else to explain this)

    OK I *think* I have it now. In R20, copied down...
    =IF(P20=0,IF(P19=0,R19,Q20),IF(AND(IF(Q20=0,P20,0)<>0,IF(Q19=0,P19,0)=0),IF(Q20=0,P20,0),R19))

  26. #26
    Registered User
    Join Date
    05-02-2014
    Location
    Can
    MS-Off Ver
    Excel 2003
    Posts
    23

    Re: Reference a the first cell when.... (not sure how else to explain this)

    Quote Originally Posted by FDibbins View Post
    OK I *think* I have it now. In R20, copied down...
    =IF(P20=0,IF(P19=0,R19,Q20),IF(AND(IF(Q20=0,P20,0)<>0,IF(Q19=0,P19,0)=0),IF(Q20=0,P20,0),R19))
    SO CLOSE! The problem is when there are zero's in both I&J. Please check out the attachment: (I hope we can fix it)
    Excel Forum Question 8 - May2,14.xls

  27. #27
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,938

    Re: Reference a the first cell when.... (not sure how else to explain this)

    I almost have it, but the variations of values and zeros in P throw me off every time

    P
    Q
    R
    S
    24
    5
    0
    5
    5
    25
    0
    0
    0
    5
    26
    7
    0
    7
    7
    27
    0
    0
    0
    7
    28
    3
    0
    3
    3


    I changed it to this...
    =IF(AND(P20=0,Q20=0),S19,IF(P20=0,IF(P19=0,R19,Q20),IF(AND(IF(Q20=0,P20,0)<>0,IF(Q19=0,P19,0)=0),IF(Q20=0,P20,0),R19)))

    but is still kicks out if there is a value in A after a value/zero combo

  28. #28
    Forum Contributor
    Join Date
    01-25-2014
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    434

    Re: Reference a the first cell when.... (not sure how else to explain this)

    in column C use this formula, based on your example file, it was placed in C4 and copied/pastd down
    Please Login or Register  to view this content.
    i'll attach the file in a sec

  29. #29
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,466

    Re: Reference a the first cell when.... (not sure how else to explain this)

    How about this:
    =IF(OR(SUM($I$20:I20)=0,SUM($J$20:J20)=0),$I$20+$J$20,INDEX($I$20:$I$41+$J$20:$J$41,MIN(LOOKUP(2,1/($I$20:I20>0),ROW($I$20:I20)-MIN(ROW($I$20:I20))+1),LOOKUP(2,1/($J$20:J20>0),ROW($I$20:I20)-MIN(ROW($I$20:I20))+1))+1))
    Attached Files Attached Files
    Quang PT

  30. #30
    Forum Contributor
    Join Date
    01-25-2014
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    434

    Re: Reference a the first cell when.... (not sure how else to explain this)

    i think i just lost the plot

    but here's an example file of what i thought this guy wanted
    Attached Files Attached Files

  31. #31
    Forum Contributor
    Join Date
    01-25-2014
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    434

    Re: Reference a the first cell when.... (not sure how else to explain this)

    might need to make adjustments to the formula to account for zero values rather than "" in cells

  32. #32
    Registered User
    Join Date
    05-02-2014
    Location
    Can
    MS-Off Ver
    Excel 2003
    Posts
    23

    Re: Reference a the first cell when.... (not sure how else to explain this)

    Quote Originally Posted by bebo021999 View Post
    How about this:
    =IF(OR(SUM($I$20:I20)=0,SUM($J$20:J20)=0),$I$20+$J$20,INDEX($I$20:$I$41+$J$20:$J$41,MIN(LOOKUP(2,1/($I$20:I20>0),ROW($I$20:I20)-MIN(ROW($I$20:I20))+1),LOOKUP(2,1/($J$20:J20>0),ROW($I$20:I20)-MIN(ROW($I$20:I20))+1))+1))
    Thank you very much for trying to but it doesn't work just yet. The error occurs when there are zero's one row prior to switching to a new column. I attached the workbook highlighting the error make it very clear. I hope you can think of a way to fix this. Thanks again.
    Excel Forum Question 8 - May2,14 (B).xls

  33. #33
    Registered User
    Join Date
    05-02-2014
    Location
    Can
    MS-Off Ver
    Excel 2003
    Posts
    23

    Re: Reference a the first cell when.... (not sure how else to explain this)

    Quote Originally Posted by ThirtyTwo View Post
    i think i just lost the plot

    but here's an example file of what i thought this guy wanted
    I appreciate your effort but it seems to not work when "formulas" instead of absolute values are used for inputs. Earlier in this thread we had to address this and we have been having problems finding a solution ever since. I have posted a lot of example files to try to demonstrate exactly what I'm looking for... it has been tough! I've attached another one here.
    Excel Forum Question 5 - May2,14.xls

  34. #34
    Registered User
    Join Date
    05-02-2014
    Location
    Can
    MS-Off Ver
    Excel 2003
    Posts
    23

    Re: Reference a the first cell when.... (not sure how else to explain this)

    Quote Originally Posted by FDibbins View Post
    I almost have it, but the variations of values and zeros in P throw me off every time

    P
    Q
    R
    S
    24
    5
    0
    5
    5
    25
    0
    0
    0
    5
    26
    7
    0
    7
    7
    27
    0
    0
    0
    7
    28
    3
    0
    3
    3


    I changed it to this...
    =IF(AND(P20=0,Q20=0),S19,IF(P20=0,IF(P19=0,R19,Q20),IF(AND(IF(Q20=0,P20,0)<>0,IF(Q19=0,P19,0)=0),IF(Q20=0,P20,0),R19)))

    but is still kicks out if there is a value in A after a value/zero combo
    I really seem to have posted a doozy. I'm still looking for that solution. Are you still trying or have you thrown in the towel? I really appreciate your effort.

  35. #35
    Registered User
    Join Date
    05-02-2014
    Location
    Can
    MS-Off Ver
    Excel 2003
    Posts
    23

    Re: Reference a the first cell when.... (not sure how else to explain this)

    Can anyone help? Can anyone modify these close attempts to solve their glitches?

  36. #36
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,938

    Re: Reference a the first cell when.... (not sure how else to explain this)

    I have not given up yet, just letting my mind idle (plus tried again to call in the big guns)

  37. #37
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Reference a the first cell when.... (not sure how else to explain this)

    Hello Mr_Fancy_Pants,

    This is a difficult one. Maybe as per the revised sample on Sheet 2 of the Workbook attached?

    Regards
    Attached Files Attached Files

  38. #38
    Registered User
    Join Date
    05-02-2014
    Location
    Can
    MS-Off Ver
    Excel 2003
    Posts
    23

    Re: Reference a the first cell when.... (not sure how else to explain this)

    Quote Originally Posted by Winon View Post
    Hello Mr_Fancy_Pants,

    This is a difficult one. Maybe as per the revised sample on Sheet 2 of the Workbook attached?

    Regards
    I attached the glitch we get with the file you attached. Zero's on both sides cause a problem with the result.
    Excel Forum Question 6 - May6,14-Winon (B).xls

  39. #39
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Reference a the first cell when.... (not sure how else to explain this)

    Maybe like this?
    Attached Files Attached Files
    Remember what the dormouse said
    Feed your head

  40. #40
    Registered User
    Join Date
    05-02-2014
    Location
    Can
    MS-Off Ver
    Excel 2003
    Posts
    23

    Re: Reference a the first cell when.... (not sure how else to explain this)

    Quote Originally Posted by romperstomper View Post
    Maybe like this?
    I'm getting excited but a little confused. When I open the spreadsheet it works as displayed. If I click on the formula and hit enter (without making any changes) I get the "#VALUE!" error. In other words the formula appears to be working until I tried to inspect it (but without making changes). Thoughts?
    Excel Forum Question 5 - May2,14 (B).xls

  41. #41
    Registered User
    Join Date
    05-02-2014
    Location
    Can
    MS-Off Ver
    Excel 2003
    Posts
    23

    Re: Reference a the first cell when.... (not sure how else to explain this)

    Quote Originally Posted by romperstomper View Post
    Maybe like this?
    I'm getting excited but a little confused. When I open the spreadsheet it works as displayed. If I click on the formula and hit enter (without making any changes) I get the "#VALUE!" error. In other words the formula appears to be working until I tried to inspect it (but without making changes). Thoughts?
    Attachment 316400

    Duplicate post by accident. Sorry. I'd delete it if I could.

  42. #42
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Reference a the first cell when.... (not sure how else to explain this)

    It's an array formula so you have to use Ctrl+Shift+Enter to enter it in a cell, not just Enter.

  43. #43
    Registered User
    Join Date
    05-02-2014
    Location
    Can
    MS-Off Ver
    Excel 2003
    Posts
    23

    Re: Reference a the first cell when.... (not sure how else to explain this)

    Quote Originally Posted by romperstomper View Post
    It's an array formula so you have to use Ctrl+Shift+Enter to enter it in a cell, not just Enter.
    Thanks. This may sound silly but how do I copy the formula down? I get the error message "you can not change part of an array".

  44. #44
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,938

    Re: Reference a the first cell when.... (not sure how else to explain this)

    Rory, thanks for the assist

    To copy an ARRAY, copy the 1st cell, move to the 2nd and then copy from there

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 3
    Last Post: 05-19-2017, 12:47 PM
  2. Linking a tab name from a cell? I'll explain - need help
    By dseg in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-29-2013, 11:01 AM
  3. [SOLVED] Using lookup to reference another cell??? I guess is how i explain that.
    By greenfox74 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-06-2013, 12:34 AM
  4. using x as cell number hard to explain
    By wkp2101 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 11-06-2008, 03:22 PM
  5. Explain code - contents of the active cell
    By shilpz in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-23-2008, 06:22 AM

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