+ Reply to Thread
Results 1 to 20 of 20

Array set for Conditional Formatting

  1. #1
    Valued Forum Contributor
    Join Date
    03-28-2014
    Location
    Kuala Lumpur, Malaysia
    MS-Off Ver
    Excel 2016
    Posts
    702

    Array set for Conditional Formatting

    Hi,

    Anyone please help me.

    I want to change font color to red if cells value not blanks and less than 3.00.

    However it seems the array set does not work =AND($J$2:$J$193<2.995,$J$2:$J$193<>"")
    1. Thank those who have helped you by clicking the Star * below the post.
    2. Please mark your post [SOLVED] if it has been answered satisfactorily.

    Sincerely,
    Farid

  2. #2
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Array set for Conditional Formatting

    try:

    1. select J2
    2. in CF type: =J2<3
    3. in CF select font color (in this caae: red)
    4. close CF
    5. use Format Painter (J2 is selected) and paint as far as you need (prob. to J193)
    6. You don't need second condition because if cell is blank you don't see any font and color

    or simpler:
    1. select J2:J193
    2. CF type =J2<3
    3. select font color
    4. OK and close CF
    5. the same as #6 above
    Last edited by sandy666; 03-30-2016 at 12:41 AM.

  3. #3
    Valued Forum Contributor
    Join Date
    03-28-2014
    Location
    Kuala Lumpur, Malaysia
    MS-Off Ver
    Excel 2016
    Posts
    702

    Re: Array set for Conditional Formatting

    Hi sandy,

    sorry. Actually to change Cells color & Font. not only font.


    I have place this formula to "Format values where this formula true"
    =AND($J$2:$J$193<2.995,$J$2:$J$193<>"")

    but it does not work.

  4. #4
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Array set for Conditional Formatting

    what's the difference font or background or both?

    select your range and use in CF: =AND($J2<3,$J2<>"") then choose colors.

    Edit:
    Your formula [ =AND($J$2:$J$193<2.995,$J$2:$J$193<>"") ] will work IF all values in range will be less than 3 and all cells in range will not be blank. IF any value will be =3 or >3 or any cell will be blank - color will not be changed.
    Last edited by sandy666; 03-30-2016 at 02:17 AM.

  5. #5
    Valued Forum Contributor
    Join Date
    03-28-2014
    Location
    Kuala Lumpur, Malaysia
    MS-Off Ver
    Excel 2016
    Posts
    702

    Re: Array set for Conditional Formatting

    Hi sandy,

    CF: =AND($J2<3,$J2<>"") working fine

    but edited formula which involves Array set does not work [ =AND($J$2:$J$193<2.995,$J$2:$J$193<>"") ] or =AND($J$2:$J$193<2.995,$J$2:$J$193<>"")

    we also cannot apply curly braces {} CTRL+SHIFT+ENTER in conditional Formatting rules, right ?


    I think the problem is how to apply array set in CF rules. I'm really frustrated.
    I am familar using macro

    For Each rngCell In wsht.Range("J2:J" & wsht.Cells(Rows.Count, "J").End(xlUp).Row)
    If rngCell.Value < 3 Then rngCell.Font.Color = vbRed
    Next rngCell

    but for this issue it is not efficient method because Microsoft has already built up function for users

  6. #6
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Array set for Conditional Formatting

    square brackets was for show formula not for use with brackets
    formula cannot be entered as array into CF.
    your formula is:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    with no brackets. but like I said above: it works in CF only (show colors) if every cell in range is not empty AND every value in range is less than 3. (or 2.995 , whatever)

    In Excel Formulas & Functions I am not VBA hero. Maybe in Excel Programming / VBA / Macros if I must. But I prefer formulas and function
    Last edited by sandy666; 03-30-2016 at 03:12 AM.

  7. #7
    Valued Forum Contributor
    Join Date
    03-28-2014
    Location
    Kuala Lumpur, Malaysia
    MS-Off Ver
    Excel 2016
    Posts
    702

    Re: Array set for Conditional Formatting

    Thanks for feedback. I have added reputation to you even tough not resolving my problem.


    hopefully some else may help me how to apply multiple range (Array Set) in CF

    CF: =AND($J2<3,$J2<>"") working fine

    CF: =AND($J$2:$J$193<3,$J$2:$J$193<>"") does not work

  8. #8
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Array set for Conditional Formatting

    Select range J1:J10 and add CF: =AND($J$1:$J$10<3,$J$1:$J$10<>"") (little range for test), select colors and ok. Next fill all cells (10) in range with numbers less than 3. You will see it works. If any of number in range willl be 3 or higher, range lost color. Also if any of cell will be empty - range will lost color.

    If you want enter your formula as array into CF you need call Microsoft Support.

    Thanks for rep of course

  9. #9
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Array set for Conditional Formatting

    Formulas entered into the CF refedit (that's what that little box is called) will automatically be evaluated as an array formula and there's no need to use the key combination of CTRL,SHIFT,ENTER to produce the squiggly brackets { } (which will not work in the refedit).
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  10. #10
    Valued Forum Contributor
    Join Date
    03-28-2014
    Location
    Kuala Lumpur, Malaysia
    MS-Off Ver
    Excel 2016
    Posts
    702

    Re: Array set for Conditional Formatting

    Hi Tony/sandy,

    I have tried the formula but it does not work

    Attached here is my workbook
    https://maybank.sharefile.com/share?...04da?_k=mu1yvd

    seek assistance please

  11. #11
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Array set for Conditional Formatting

    in range type: 1,2,1,-2,0,1,2,2,1,0 all < 3 you will see red. if any of cells will be empty range will lost color. if any of values willl be < 3 - range will lost color. enough ONE cell with number >=3 or ONE empty cell to clear range from color.

    but basically you did not tell what exactly you want to achieve
    Attached Files Attached Files
    Last edited by sandy666; 03-30-2016 at 06:42 AM.

  12. #12
    Valued Forum Contributor
    Join Date
    03-28-2014
    Location
    Kuala Lumpur, Malaysia
    MS-Off Ver
    Excel 2016
    Posts
    702

    Re: Array set for Conditional Formatting

    Hi sandy,

    I have open your workbook. There is no red color for those mentioned range. i have put these values for "J1:J10" 1,2,1,-2,0,1,2,2,1,0

    Anything wrong with my Office? I will try at home tonight.

  13. #13
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Array set for Conditional Formatting

    with YOUR workbook
    I added ten digits there and one of them is in DataValidation to choose digit less than 3 or higher/equal 3. if you change this value it should show red or turn off red. formula was not changed and it works on my lap. So, the rest ... I don't know why it doesn't work on yours, sorry

  14. #14
    Valued Forum Contributor
    Join Date
    03-28-2014
    Location
    Kuala Lumpur, Malaysia
    MS-Off Ver
    Excel 2016
    Posts
    702

    Re: Array set for Conditional Formatting

    Hi sandy,

    Finally, I understand what you mean, changing cell in data validation to 0 will cause all cells in range "J1:J10" turn to red. If any cells in these range change to >= 3, the red color will gone for entire range "J1:J10". It is NOT what I want. I want CF to change for only cell value <3 not entire range.

    e.g. if cell values in J5 <3, only J5 turn to red.

    J1 4
    J2 2 ---- cell J2 turn to red
    J3 3
    J4 6
    J5 1 ---- cell J5 turn to red
    J6 7
    ''
    ''
    J10 9

    it is misunderstood between myself and you.
    I think it is NOT the accurate formula =AND($J$2:$J$193<3,$J$2:$J$193<>"") .

    I cannot create CF for each cell because range of data is determine by range end Cells(Rows.Count, "J").End(xlUp).Row
    Last edited by Faridwahidi; 03-30-2016 at 11:15 AM.

  15. #15
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,879

    Re: Array set for Conditional Formatting

    This works

    =AND(J1<>"",J1<3)

    Set Applies To: =$J$1:$J$500 (or whatever length range you need)
    Attached Files Attached Files

  16. #16
    Valued Forum Contributor
    Join Date
    03-28-2014
    Location
    Kuala Lumpur, Malaysia
    MS-Off Ver
    Excel 2016
    Posts
    702

    Re: Array set for Conditional Formatting

    Hi John,

    Thanks a lot problem solved, Set Applies to

    I feel really confused, what went wrong with this? why we can't apply array formula in CF, =AND($J$2:$J$193<3,$J$2:$J$193<>"")

    I think my poor understanding on CF

  17. #17
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Array set for Conditional Formatting

    Quote Originally Posted by Faridwahidi View Post
    =AND($J$2:$J$193<3,$J$2:$J$193<>"")
    With that formula EVERY cell within the range would have to be a number <3.

    It's evaluating ALL cells as a group when you need to evaluate EACH individual cell.

  18. #18
    Valued Forum Contributor
    Join Date
    03-28-2014
    Location
    Kuala Lumpur, Malaysia
    MS-Off Ver
    Excel 2016
    Posts
    702

    Re: Array set for Conditional Formatting

    Thanks tony.

  19. #19
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Array set for Conditional Formatting

    You're welcome!

  20. #20
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Array set for Conditional Formatting

    Quote Originally Posted by sandy666 View Post
    select your range and use in CF: =AND($J2<3,$J2<>"") then choose colors.
    That is what I said in #4

+ 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. Conditional Formatting with Array Formulas
    By zmster2033 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-27-2015, 02:38 PM
  2. Using an array and conditional formatting
    By seangun in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 04-18-2014, 07:57 AM
  3. [SOLVED] Conditional formatting with IF/AND/OR (array's?)
    By anghicole in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 09-06-2013, 04:17 AM
  4. [SOLVED] Conditional Formatting with array formula
    By kadams99 in forum Excel General
    Replies: 5
    Last Post: 07-03-2013, 11:48 AM
  5. Conditional Formatting in an array while using edate
    By svalentine91 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-30-2013, 05:36 PM
  6. Excel 2007 : Conditional formatting, searching array
    By astillar in forum Excel General
    Replies: 1
    Last Post: 06-27-2010, 01:56 AM
  7. Conditional formatting based upon array
    By RocketMan in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-16-2006, 12:10 PM

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