+ Reply to Thread
Results 1 to 5 of 5

Comparing text in two cells to create text in another

  1. #1
    Registered User
    Join Date
    12-13-2011
    Location
    edinburgh
    MS-Off Ver
    Excel 2003
    Posts
    2

    Comparing text in two cells to create text in another

    I need to create a formula that compares the text entries in 2 cells and populates another one with a text entry (in this case red, green or amber)
    This needs to compare 9 different combinations.

    Cell A Cell B Then Cell C =

    Low Low Green
    Low Med Amber
    Low High Amber
    Med Low Amber
    Med Med Amber
    Med High Red
    High Low Amber
    High Med Red
    High High Red

    I just don't know how to compile a formula that combines 9 different conditions. Hope someone can help.

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,352

    Re: Comparing text in two cells to create text in another

    Hi gareths69 and welcome to the forum,

    Find the attached where I use a lookup table to return the colors in column C.
    Attached Files Attached Files
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Comparing text in two cells to create text in another

    Alternate formula:
    =INDEX({"Green","Amber","Red"},ROUNDUP((MATCH(A1,{"Low","Med","High"},0)+MATCH(B1,{"Low","Med","High"},0))/2,0))

    Array formula version (confirmed with Ctrl+Shift+Enter):
    =INDEX({"Green","Amber","Red"},ROUNDUP(SUM(MATCH(A1:B1,{"Low","Med","High"},0))/2,0))
    Hope that helps,
    ~tigeravatar

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  4. #4
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Comparing text in two cells to create text in another

    Non-array version using SumProduct instead of Sum:
    =INDEX({"Green","Amber","Red"},ROUNDUP(SUMPRODUCT(MATCH(A1:B1,{"Low","Med","High"},0))/2,0))

  5. #5
    Registered User
    Join Date
    12-13-2011
    Location
    edinburgh
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Comparing text in two cells to create text in another

    Thanks very much for the help!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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