+ Reply to Thread
Results 1 to 12 of 12

Conditional Formatting for Numbers Followed by Text

  1. #1
    Registered User
    Join Date
    03-21-2021
    Location
    Solihull
    MS-Off Ver
    2019
    Posts
    4

    Conditional Formatting for Numbers Followed by Text

    Hi All

    Hoping someone can point me in the right direction.
    My wife is a teacher and for some reason only known to education they insist on using numbers followed by a plus (+) or minus (-) sign.
    e.g. 1+; 5-; etc.

    She then has to compare and highlight the greater or lesser value depending on the purpose of the data.
    So if 1 child is awarded 1 another could be awarded 1+ which in the world of education is then higher than 1.
    or 5 and 5- where 5- is considered lower than 5.
    Why they don't just work on a scale of 1-10 or 1-20 only education knows.
    The obvious complication here is that excel treats the trailing symbol as text.

    I would like to be able to create a conditional format whereby I can compare the values in one column, say A1 with A2 and highlight the greater or smaller number assuming:
    A1=1 and A2=1- or A2=1+

    If anyone has managed this I would be massively grateful as this process takes ages when done manually especially when there are 300 or 400 kids.

    Thanks for now

  2. #2
    Forum Expert
    Join Date
    07-06-2004
    Location
    Northern California
    MS-Off Ver
    2K, 2003, 2010, O365
    Posts
    1,490

    Re: Conditional Formatting for Numbers Followed by Text

    The ideal way to handle this would be to use a table which converts arbitrary labels into ordinal integers. If 1+ were best, 5- worst, best to insert a new worksheet, enter the following table in A1:B15 in that worksheet.

    A B
    1 1+ 1
    2 1 2
    3 1- 3
    4 2+ 4
    5 2 5
    6 2- 6
    7 3+ 7
    8 3 8
    9 3- 9
    10 4+ 10
    11 4 11
    12 4- 12
    13 5+ 13
    14 5 14
    15 5- 15

    Name this range CNVTBL, sort it in ascending order on column A (note that Excel considers numeric 1 and text "1" to be different values), and use lookups to convert[1-5]{|+|-} grades into ordinals.

    Use this in conditional formatting like so: with grades in C3:C27, use conditional formatting formula criteria like =LOOKUP(C3,CNVTBL)=MIN(LOOKUP(C$3:C$27,CNVTBL)).

    As a general rule, lookup conversion tables are the most robust way to convert arbitrary grade labels into a numeric scale.

  3. #3
    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: Conditional Formatting for Numbers Followed by Text

    The easiest thing to do here is to make a table with all possible values, then use MATCH to get the corresponding rank of the value. What is the complete set of numbers they use? I have mocked up an example to show you my thinking, using 1-5 with no sign, -, and +.

    Also you said compare the values in one column. You mean compare pairs of values in a single column? row 1 to 2, 3, to 4? A more common need would be to compare column A to column B, but I did just what you described.

    Also, no disrespect meant to your educational system but this the dumbest thing I've ever heard of.
    Attached Files Attached Files
    Jeff
    | | |·| |·| |·| |·| | |:| | |·| |·|
    Read the rules
    Use code tags to [code]enclose your code![/code]

  4. #4
    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: Conditional Formatting for Numbers Followed by Text

    I see we have two interpretations of how the numbers are ranked, and it would help to clear that up. I assumed 1- is lowest and 5+ is highest, and hrlngrv assumed 1+ is highest and 5- is lowest.

    hrlngrv listed the values explicitly, and uses VLOOKUP to look them up; in mine the ranking is implied by the order they are in and MATCH returns the position as the value. Either works just as well.

    I also included the conditional formatting.

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

    Re: Conditional Formatting for Numbers Followed by Text

    I would suggest highlight Number+ with strong colour (orange), and Number- with week colour (blue)

    Number +
    =ISNUMBER(SEARCH("+",C1))

    Number -
    =ISNUMBER(SEARCH("-",C1))
    Attached Images Attached Images
    Attached Files Attached Files
    Quang PT

  6. #6
    Forum Expert
    Join Date
    07-06-2004
    Location
    Northern California
    MS-Off Ver
    2K, 2003, 2010, O365
    Posts
    1,490

    Re: Conditional Formatting for Numbers Followed by Text

    Picky: I used LOOKUP rather than VLOOKUP because LOOKUP is more reliable when given array/range 1st arguments.

    Main point is that CNVTBL's 2nd column values could be anything which makes sense. They could have been {98;95;92;89;85; . . . }. 2-column lookup tables are more flexible than using MATCH.

  7. #7
    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: Conditional Formatting for Numbers Followed by Text

    My bad, my fingers decided what to type.

    Yes, either solution could be effective depending on exactly how the OP needs to use it.

  8. #8
    Registered User
    Join Date
    03-21-2021
    Location
    Solihull
    MS-Off Ver
    2019
    Posts
    4

    Re: Conditional Formatting for Numbers Followed by Text

    Hi All

    Thank you very much for all the help so far.

    Sorry my replies have been a bit slow. Long day on the main job.
    I realised I didn't explain very well and I forgot to attach my in progress template. It was late :D
    Now attached.

    Basically the kids are given a predicted a grade in 1 column (O) and then in the next column (P) they are given their actual grade.
    The teacher then has to highlight those achieving above their grade in green and those achieving below their predicted grade in red.
    I've put the colours in manually to illustrate.
    Apparently this ridiculous series of grades was concocted by either the government of one of their clown consultants.
    So if you aren't quite achieving grade 1 then you get 1- and if you are just over but not quite 2 then it's 1+ all the way up to 9+

    I can't quite believe this is the best that they could come up with.
    Attached Files Attached Files

  9. #9
    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: Conditional Formatting for Numbers Followed by Text

    Here it is with the method I suggested, though of course, that's not the only way.
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    03-21-2021
    Location
    Solihull
    MS-Off Ver
    2019
    Posts
    4

    Re: Conditional Formatting for Numbers Followed by Text

    That is absolutely brilliant thank you. Honestly I can't thank you enough. Neither can a whole department of teachers

  11. #11
    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: Conditional Formatting for Numbers Followed by Text

    Suggest that next year they use 1-30.

  12. #12
    Registered User
    Join Date
    03-21-2021
    Location
    Solihull
    MS-Off Ver
    2019
    Posts
    4

    Re: Conditional Formatting for Numbers Followed by Text

    I can only hope.

+ 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. [SOLVED] Conditional formatting involving numbers and text
    By motokaxperts in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 05-22-2019, 10:52 AM
  2. Conditional Formatting numbers only, not text
    By FarazM in forum Excel General
    Replies: 4
    Last Post: 04-08-2014, 01:50 PM
  3. Conditional formatting, checking text and between 2 numbers... HELP!!
    By jenncess in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-12-2014, 06:30 PM
  4. Conditional Formatting text to numbers
    By Techie2k in forum Excel - New Users/Basics
    Replies: 3
    Last Post: 07-01-2013, 10:44 AM
  5. Replies: 2
    Last Post: 04-12-2013, 09:30 AM
  6. Replies: 9
    Last Post: 03-26-2012, 02:16 PM
  7. conditional formatting with numbers and text
    By Daniel in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-17-2005, 03:05 PM

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