+ Reply to Thread
Results 1 to 11 of 11

Replace a term in one column with value in next column

  1. #1
    Registered User
    Join Date
    05-01-2021
    Location
    NY, US
    MS-Off Ver
    MS 2016 (18.2008.12711.0)
    Posts
    7

    Replace a term in one column with value in next column

    =COUNTIF(A1:A347, "Alabama") | Alaska
    =COUNTIF(A1:A347, "Alabama") | Arizona
    =COUNTIF(A1:A347, "Alabama") | Arkansas

    How can I replace the "Alabama"s in the first column with the "Alaska", "Arizona" and "Arkansas" in the second column such that it becomes

    =COUNTIF(A1:A347, "Alaska") | Alaska
    =COUNTIF(A1:A347, "Arizona") | Arizona
    =COUNTIF(A1:A347, "Arkansas") | Arkansas

    I am willing to replace the terms manually, but learning how to do it via a formula would be useful for similar tasks in the near future.
    Attached Files Attached Files
    Last edited by reags; 05-03-2021 at 09:12 AM.

  2. #2
    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
    28,202

    Re: Replace all instances of a certain term in first column with values in second column

    Welcome to the forum

    Please attach a sample workbook (not a picture or pasted copy). Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

  3. #3
    Registered User
    Join Date
    05-01-2021
    Location
    NY, US
    MS-Off Ver
    MS 2016 (18.2008.12711.0)
    Posts
    7

    Re: Replace all instances of a certain term in first column with values in second column

    I have attached an Excel file showing Before and After.
    Attached Files Attached Files
    Last edited by reags; 05-01-2021 at 11:11 AM.

  4. #4
    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
    28,202

    Re: Replace all instances of a certain term in first column with values in second column

    Still not sur what you want but you can replace the hard-code text:

    =COUNTIFS(AM1:AM8, "(VOL) Neither/Both equally", E1:E8, F12)/COUNTIFS(E1:E8, F12)*100

  5. #5
    Registered User
    Join Date
    05-01-2021
    Location
    NY, US
    MS-Off Ver
    MS 2016 (18.2008.12711.0)
    Posts
    7

    Re: Replace all instances of a certain term in first column with values in second column

    Unfortunately, I can't do that for an entire column of states, because I would have to do it for each cell manually. The other cell references can't change, but if I dragged that formula down the column, the other cell references would change in addition to that cell reference. For example, =COUNTIFS(AM1:AM8, "(VOL) Neither/Both equally", E1:E8, F12)/COUNTIFS(E1:E8, F12)*100 would change into =COUNTIFS(AM2:AM9, "(VOL) Neither/Both equally", E2:E9, F13)/COUNTIFS(E2:E9, F13)*100 instead of =COUNTIFS(AM1:AM8, "(VOL) Neither/Both equally", E1:E8, F13)/COUNTIFS(E1:E8, F13)*100
    The formula suggested is also incorrect because it references a column in the "After" example instead of the second column in the "Before" example.
    I have edited the file to make it more clear.
    Attached Files Attached Files
    Last edited by reags; 05-01-2021 at 11:08 AM.

  6. #6
    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
    28,202

    Re: Replace all instances of a certain term in first column with values in second column

    Your file does not explain anything (to me) : if you want ranges to remain static

    =COUNTIFS($AM$1:$AM$8, "(VOL) Neither/Both equally", $E$1:$E$8, B11)/COUNTIFS($E$1:$E$8, B11)*100

    This formula can be dragged down and only B will change.

    I'll leave to others to "decode" what you want.

  7. #7
    Registered User
    Join Date
    05-01-2021
    Location
    NY, US
    MS-Off Ver
    MS 2016 (18.2008.12711.0)
    Posts
    7

    Re: Replace all instances of a certain term in first column with values in second column

    Thank you so much. I didn't realize you could do that.
    I want the "Alabama"s in the first column replaced by whatever's in the corresponding cells in the second column.
    Last edited by reags; 05-01-2021 at 11:21 AM.

  8. #8
    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
    28,202

    Re: Replace all instances of a certain term in first column with values in second column

    What is "first column" (A,B, C) vs "second column" I,J K ????

  9. #9
    Registered User
    Join Date
    05-01-2021
    Location
    NY, US
    MS-Off Ver
    MS 2016 (18.2008.12711.0)
    Posts
    7

    Re: Replace all instances of a certain term in first column with values in second column

    I thought that that would work, but I need quotation marks around "B11" and when I do it looks up literally "B11" instead of what's in the cell B11.

  10. #10
    Registered User
    Join Date
    05-01-2021
    Location
    NY, US
    MS-Off Ver
    MS 2016 (18.2008.12711.0)
    Posts
    7

    Re: Replace all instances of a certain term in first column with values in second column

    The first column is A12, A13 and the second column is B12, B13. I'm trying to replace the "Alabama"s in A12 with the value in B12 and the "Alabama"s in A13 with the value in B13.

  11. #11
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,830

    Re: Replace a term in one column with value in next column

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however it has been brought to our attention that the same query has been posted on one or more other forums and you have not provided the required cross-post link(s) here.

    Please see Forum Rule #3 about cross-posting and adjust accordingly. Read this to understand why we (and other sites like us) consider this to be important.

    (Note: this requirement is not optional. As you are new I will post the link fir you today: https://www.excelguru.ca/forums/show...in-next-column.)
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

+ 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. Replies: 7
    Last Post: 10-26-2020, 07:05 AM
  2. [SOLVED] Count number of unique values in Column A that match a term in Column B
    By frsaxon in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-29-2016, 07:22 AM
  3. Locate all the instances of a list of values in one column in another column
    By norwoodkd2001 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 07-01-2015, 09:52 AM
  4. Sum up a column based off adjacent column and replace values with the sum.
    By kleptilian in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-13-2015, 11:55 AM
  5. Replies: 4
    Last Post: 12-16-2013, 06:29 PM
  6. [SOLVED] When a search term appears in column I, copy the value from column H to a new cell.
    By ShallowJamm in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 10-28-2012, 06:36 PM
  7. Replies: 1
    Last Post: 09-14-2011, 09:56 AM

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