+ Reply to Thread
Results 1 to 2 of 2

IF formula in Excel / Replace numbers with 'words'

  1. #1
    Registered User
    Join Date
    04-07-2006
    Posts
    1

    IF formula in Excel / Replace numbers with 'words'

    Hey there,

    I got the following table: see below

    Now what I want to do, is to replace the numbers with words.

    In words this would look something like this

    FOR ROW Q:

    If Value'Q' = 1 replace by A
    If Value'Q' = 2 replace by B

    FOR ROW R:

    If Value'Q' = 1 and Value 'R' = 1 replace by aa
    If Value'Q' = 1 and Value 'R' = 2 repalce by aa'
    If Value'Q' = 2 and Value 'R' = 1 replace by bb

    etc ...

    I hope this explains it.

    Cheers and thx a lot.

    Philipp
    Attached Images Attached Images

  2. #2
    Forum Contributor
    Join Date
    03-13-2005
    Posts
    6,195
    I guess the two difficulties are that 1) Excel doesn't replace other cell values unless you use VB code, and 2) in a 2 part test, if Value'Q' were replaced then value R would fail the test because value Q was no longer a 1 or 2, therefore the test is failed, therefore the Q value should not have been changed (or something like that)

    So, instead of 'changing' the values, I would use a second sheet and in cell A1 put:

    =IF(Sheet1!A1="","",Sheet1!A1)

    and formula-drag that across and down to cover all required cells.

    This would give me an active copy. (ie, if you change Sheet1 it will be reflected here)

    Then, for the required Q row, in cell Q1 use

    =IF(Sheet1!Q1="","",if(Sheet1!Q1=1,"A",Sheet1!Q1))

    and formula drag that across for the number of cells required to be changed,

    and for row R, in cell R1 put

    =IF(Sheet1!R1="","",IF(AND(Sheet1!Q1=1,Sheet1!R1=1),"aa",IF(AND(Sheet1!Q1=1,Sheet1!R1=2),"aa'",IF(AND(Sheet1!Q1=2,Sheet1!R1=1),"bb",Sheet1!R1))))

    and formula drag that down to cover all required cells.

    This should provide the look you require.

    Note, when you copy and paste these formula, watch for inserted spaces and remove them.
    --



    Quote Originally Posted by Emsmaps
    Hey there,

    I got the following table: see below

    Now what I want to do, is to replace the numbers with words.

    In words this would look something like this

    FOR ROW Q:

    If Value'Q' = 1 replace by A
    If Value'Q' = 2 replace by B

    FOR ROW R:

    If Value'Q' = 1 and Value 'R' = 1 replace by aa
    If Value'Q' = 1 and Value 'R' = 2 repalce by aa'
    If Value'Q' = 2 and Value 'R' = 1 replace by bb

    etc ...

    I hope this explains it.

    Cheers and thx a lot.

    Philipp

+ 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