+ Reply to Thread
Results 1 to 19 of 19

Condtional formatting from last non-blank cell

  1. #1
    Forum Contributor
    Join Date
    11-13-2015
    Location
    London
    MS-Off Ver
    Office 365
    Posts
    831

    Condtional formatting from last non-blank cell

    Hi all,

    i have column A2:A20 populated with customer names

    From column B2-Z2 I have a number for each month. B1 = July, C1= AUgust and so

    I want a conditional formatting for A2 to be populated from the last non-blank cell from the range b2:z2. Can someone advise pleasde?

    thank you!
    Thanks,

    R.



  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,404

    Re: Condtional formatting from last non-blank cell

    Conditional formatting??? You cannot populate a cell with CF, but you can format it.

    Explain what you want A2 to look like.

    Last non-blank:

    =LOOKUP(2,1/(B2:Z2<>""),B2:Z2)
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    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,926

    Re: Condtional formatting from last non-blank cell

    Also note that a cell with a formula in it is not (necessarily) blank
    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

  4. #4
    Forum Contributor
    Join Date
    11-13-2015
    Location
    London
    MS-Off Ver
    Office 365
    Posts
    831

    Re: Condtional formatting from last non-blank cell

    Hi AliGW,

    sorry yes i meant to say A2 would be highlighted deending on the value of what is in the last non-blank cell, how do I add to your formula, "1" (as in look up the last non-blank cell which is equal to 1), I will be writing different fomulas on A2 as well, for cells such as 1 (red), 2 (orange), 3 (green)

    thank you

  5. #5
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,404

    Re: Condtional formatting from last non-blank cell

    Try this:

    =LOOKUP(2,1/(B2:Z2=1),B2:Z2)

    A word of caution: don't go overboard on the colour-coding. Your workbooks (if I remember rightly) are already a bit of an assault on the senses. Ask yourself is it REALLY necessary to have a different colour for each of the 12 months (or quarters, or whatever) - the more colours a user has to evaluate, the harder it is, and a significant proportion of men are colour blind (around 1 in 12: http://www.colourblindawareness.org/colour-blindness/).

    LESS IS MORE!!!
    Last edited by AliGW; 07-14-2020 at 03:48 AM.

  6. #6
    Forum Contributor
    Join Date
    11-13-2015
    Location
    London
    MS-Off Ver
    Office 365
    Posts
    831

    Re: Condtional formatting from last non-blank cell

    Hi AliGW

    It is working intermittendly.

    Can you take a look at A2 attached please and advise

    Indeed less is more :-) noted your feedback thsnk you
    Attached Files Attached Files

  7. #7
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,404

    Re: Condtional formatting from last non-blank cell

    You will need this:

    =LOOKUP(2,1/(B2:Z2<>""),B2:Z2)=1

    =LOOKUP(2,1/(B2:Z2<>""),B2:Z2)=2

    =LOOKUP(2,1/(B2:Z2<>""),B2:Z2)=3

    etc.

  8. #8
    Forum Expert
    Join Date
    10-10-2016
    Location
    Sheffield
    MS-Off Ver
    365 and rarely 2016
    Posts
    3,210

    Re: Condtional formatting from last non-blank cell

    You need to understand the formula in the cf
    =LOOKUP(2,1/(B2:Z2=1),B2:Z2) returns 1 as it finds the last column with a 1 in and then its value 1!
    =LOOKUP(2,1/(B2:Z2>0),B2:Z2) returns the last value >0. This should probably be your base

    cf =LOOKUP(2,1/(B2:Z2>0),B2:Z2) =1 red etc

  9. #9
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,404

    Re: Condtional formatting from last non-blank cell

    Example of post #7 attached.

  10. #10
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,404

    Re: Condtional formatting from last non-blank cell

    Thanks for the rep.

  11. #11
    Forum Contributor
    Join Date
    11-13-2015
    Location
    London
    MS-Off Ver
    Office 365
    Posts
    831

    Re: Condtional formatting from last non-blank cell

    thank you AliGW!

  12. #12
    Forum Contributor
    Join Date
    11-13-2015
    Location
    London
    MS-Off Ver
    Office 365
    Posts
    831

    Re: Condtional formatting from last non-blank cell

    sorry new question, is there a way to use the formula

    =LOOKUP(2,1/(B2:Z2<>""),B2:Z2)=1

    but change b2:z2 to c2, e2, h2, j2 (so it looks at c2, e2, h2, j2)?

    thank you

  13. #13
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,404

    Re: Condtional formatting from last non-blank cell

    You can't, but you can do this:

    =LOOKUP(2,1/($B$2:$Z$3="Overall Score"),$B4:$Z4)=1

    Or you might need this:

    =LOOKUP(2,1/(($B$2:$Z$3="Overall Score")*($B4:$Z4<>"")),$B4:$Z4)=1
    Last edited by AliGW; 07-15-2020 at 08:30 AM.

  14. #14
    Forum Contributor
    Join Date
    11-13-2015
    Location
    London
    MS-Off Ver
    Office 365
    Posts
    831

    Re: Condtional formatting from last non-blank cell

    thank you AliGW

    should do the trick (2nmd formula!)

  15. #15
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,404

    Re: Condtional formatting from last non-blank cell

    Good, good!

  16. #16
    Forum Contributor
    Join Date
    11-13-2015
    Location
    London
    MS-Off Ver
    Office 365
    Posts
    831

    Re: Condtional formatting from last non-blank cell

    Hi AliGW.all

    Upon adding in new company info my conditional formatting is not working and the ranges seem out of sync.

    I.e. if I change data in Cell C5, it affectsd A6 instead of A5..... and A4 just doesn't change colour despite me chanhging the overall score in C4?

    E4 scores does not have an impact either (the CF setup on cells in column A are using the last non blank data...........) please help!
    Attached Files Attached Files

  17. #17
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,404

    Re: Condtional formatting from last non-blank cell

    If you add rows at the top, it will mess up the formatting. Add rows only between the first and the last.

    If you need to sort tables, then use structured tables and always add rows at the bottom and then sort.
    Attached Files Attached Files
    Last edited by AliGW; 07-15-2020 at 12:56 PM.

  18. #18
    Forum Contributor
    Join Date
    11-13-2015
    Location
    London
    MS-Off Ver
    Office 365
    Posts
    831

    Re: Condtional formatting from last non-blank cell

    thanks AliGW!

  19. #19
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,404

    Re: Condtional formatting from last non-blank cell

    You're welcome.

+ 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: 04-05-2017, 06:25 PM
  2. [SOLVED] Help : Condtional formatting highlight cell porblem....??
    By Jhon Mustofa in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 09-19-2013, 06:05 AM
  3. Condtional Formatting changes in the cell value
    By mfs3 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-01-2012, 07:23 PM
  4. Condtional Formatting
    By univerco in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 10-11-2011, 05:43 PM
  5. Auto filing and condtional formatting cells based on cell value.
    By CJPHX in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-05-2011, 08:49 AM
  6. Auto filing and condtional formatting cells based on cell value.
    By SierraPants in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-04-2011, 05:59 PM
  7. Condtional Formatting: highlight MIN(s) but ignore blank cells
    By needsomehelpher in forum Excel General
    Replies: 5
    Last Post: 09-24-2010, 04:42 AM

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