+ Reply to Thread
Results 1 to 10 of 10

changing text in one cell based on the value of another

  1. #1
    Registered User
    Join Date
    10-14-2013
    Location
    london, england
    MS-Off Ver
    Excel 2010
    Posts
    5

    changing text in one cell based on the value of another

    Hello

    I have a report at work where i need to change the value of a cell depends on the value of another to make it more readable to the client.

    For example;

    Untitled.png

    When C1 = idata.o2.co.uk i need to change M1 to say Data - iPhone - Services

    I need to do this with a number of other cell values, but rather than do this manually I thought there would be a simple macro to help. Any ideas??

  2. #2
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: changing text in one cell based on the value of another

    in M1:
    =IF(C1="idata.o2.co.uk","Data - iPhone - Services","")

  3. #3
    Registered User
    Join Date
    10-14-2013
    Location
    london, england
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: changing text in one cell based on the value of another

    Thanks.

    I need to do this to multiple different cells at a time and also for other values.

  4. #4
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: changing text in one cell based on the value of another

    What are the other values? you can just drag the formula down/copy and paste into other cells.

  5. #5
    Registered User
    Join Date
    10-14-2013
    Location
    london, england
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: changing text in one cell based on the value of another

    Then i may as well do what im doing now which is pretty much the same thing without the formula. i was thinking to run a macro that looks for them values and changes it

  6. #6
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: changing text in one cell based on the value of another

    How does the macro know what values it is looking for and what to change it to?

  7. #7
    Registered User
    Join Date
    10-14-2013
    Location
    london, england
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: changing text in one cell based on the value of another

    the values it is looking for are always going to be in column C and the value being changed is always in column M but the values in column C are going to be different and depending on what they are depends on what column M is going to be changed to. So for example i want it to look for cells in column C and if they equal 'idata.o2.co.uk' then i want to change the M column in that row to 'Data - iPhone - Services' i want to do this for different values that are in Column C

  8. #8
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: changing text in one cell based on the value of another

    I meant how does the macro know what values to look for, not where to look for them.

    In other words, how does it know what the different values in column C are and what the corresponding values in column M should be.

  9. #9
    Registered User
    Join Date
    10-14-2013
    Location
    london, england
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: changing text in one cell based on the value of another

    do you not enter into the code what values to look for and so on?

  10. #10
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: changing text in one cell based on the value of another

    Well you could do the equivalent of the formula I posted:
    Please Login or Register  to view this content.
    but there is no need to do that with a macro, just write a nested if formula.

    I would probably approach this by making a lookup table, but all the possible values of column C in column A on a sheet called "lookup table" and then put the corresponding values for column M in column B on the lookup sheet.
    Then your formula in M1 becomes:
    =VLOOKUP(C1,'lookup table'!A1:B100,2)
    (change b100 to however many values you have)
    Last edited by ragulduy; 10-14-2013 at 10:58 AM.

+ 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. Changing text color of cell based on character
    By -Fate- in forum Excel General
    Replies: 8
    Last Post: 06-02-2010, 03:37 PM
  2. Changing text color based on a limit within the cell
    By jessetrunk in forum Excel General
    Replies: 1
    Last Post: 02-02-2010, 09:49 AM
  3. Changing the text on button based on cell content
    By a94andwi in forum Excel General
    Replies: 1
    Last Post: 06-11-2009, 12:58 PM
  4. Find Last Cell In range, and changing another Cell based on offset text
    By radar_jynx in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-05-2009, 04:52 AM
  5. [SOLVED] Changing the text within a function based on a cell reference.
    By jedale@gmail.com in forum Excel General
    Replies: 2
    Last Post: 07-14-2006, 12:25 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