# Replacing Contents Of A Cell With Another Based On Search Result?

Feb 24, 2014

My current problem is that I need to search two tabs of data and use the results to modify the contents of one cell in the first tab.

I'll try to be as clear as possible:

tab1 has relevant cells "a" and "b", same row

tab2 has 3 relevant cells "c", "d", and "e", all on the same row

All cells are text values - some digits, but should be treated as a regular String.

The search needs to look at cells "a" and "b", find their match in "c" and "d", then replace the original value of "b" with the value in "e" after a match has been found.

## Calculate End Result Based On Cell Contents Of 3 Columns

Jan 13, 2014

I am trying to create a formula that is able to calculate an end result based on the cell contents of 3 columns, the results are predefined in 3 other columns, here D, E & F

For example:

Column A Column B Column C Column D Column E Column F Column G (Results)
Royal Mail 1 100 2.8 2.3 1.2
Royal Mail 2 100 2.9 2.4 1.3
Royal Mail 3 100 3.0 2.5 1.4
DPD 5 200 4.5 2.8 1.5
DPOST 1 100 1.2 3.2 1.7

I am trying to create a calculation that in Column G will work out, IF Column A=Royal Mail AND Column B=1 AND Column C<=100 THEN Answer is [@[Column F]], IF Column A=Royal Mail AND Column B=2 AND Column C<=100 THEN Answer is [@[Column F]], IF Column A=Royal Mail AND Column B=3 AND Column C<=100 THEN [@[Column F]], IF Column A=DPD AND Column B=5 AND Column C<=200 THEN [@[Column E]], IF Column A=DPOST AND Column B=1 AND Column C<=100 THEN [@[Column D]]

Here are an example of what I have tried, amongst many...

=IF(AND(AND([@[Default Post Postal Service]]="Royal Mail"),AND([@[Default Postal Format]]=1),AND([@Weight]<=100)),1,0) Everything is zero.

## Replacing Contents Of Cells?

Apr 11, 2003

I am doing a "text to columns" in a VBA script and each time it runs I get a "Do you wnat to replace contents of the destination cells" prompt. I will always say yes to this prompt. Is there something I can put into the code to avoid this prompt all together, again the answer will always be yes to the prompt.

## Refernceing Cells: Formula That Looks At A Cell On A Front Sheet, And Then Returns The Contents Of That Cell As The Result If It Meets The Criteria

Apr 5, 2009

I have a formula that looks at a cell on a front sheet, and then returns the contents of that cell as the result if it meets the criteria. So for example this formula would be in Cell A1 on Sheet2 IF(SHEET1!A1,"New",Sheet1!A1,"-")

This formula is always in the same cell (different sheet) as the cell that it is looking at, down 1500 rows. Instead of having the formula named for each cell is there anyway to ask excel to 'look at this cell but on this other sheet'.
e.g IF(Sheet1!"This Cell" etc). That way no matter what cell you put the formula in it is always referencing the correct cell for the formula?

## Search For Cell Contents And Paste?

Aug 20, 2013

I have a large sheet (approx 4k rows) and need to verify the contents of each cell by taking the name and searching for it in another workbook. I then need to copy over the cell contents found under certain columns in the secondary book and paste them into appropriate columns (row where search name was found).

Ex. I search for Apple and find 6 instances of Apple in the second book. I then take the contents of the cells found under columns Make, Model, Year (all from the row that showed the results as apple) and paste that into the same-named column in the first book.

I have been doing this manually but it takes too much time.

## More Than 1 Cell As Search Range: Result Is Wrong

Apr 6, 2009

i've been using an IF function in order to display a certain value when one or more criteria are met in one cell in one specific worksheet. here's how it looks like:

=IF(OR(ISNUMBER(SEARCH("value1",Worksheet1!A1)),ISNUMBER(SEARCH("Value2",Worksheet1!A1))),"yes","no" )

with different values and names.. but it's just to give you the idea of what kind of function it is. this one works perfectly, but i also needed another one in which the logical test range is no longer only one cell, but more, thus a selection. i wrote the same formula, but instead of the "A1" i wrote for example "A1:A20" which i thought it would work.. but it doesn't. even more surprising, when i open the insert function (the helping wizard that pops up when i click the "fx" button on the left of the function string) and i put in the logical test, at the bottom of the window it says the correct result (ie: yes). but on the actual worksheet, the cell displays the wrong result (no). i know there are no errors in the formula, so i really don't know how to solve the problem.

## Internet Search Contents Of Cell Using Macro?

Mar 7, 2014

how would I go about having a button on my worksheet which is clicked will open up Internet Explorer and search the information located in a specific cell?

## Changing Search Result Cell Highlight Color?

May 10, 2013

When I do a SEARCH operation to find the number 10 among hundreds of cells containing data, I'm often finding the way Excel highlights the cell that meets the search result is not easy enough to see.

Is there anyway I could setup Excel so that the resulting cell that meets the search result is highlighted in a RED border or RED Fill? I would like the cell that meets the search result to scream at me with a color highlight that is not easy to miss.

## Search Across Columns By Row & Replace Specific Cell Contents

May 2, 2008

I have created a desk planning spreadsheet in excel. Each week a mailmerge sends out an email to everyone in the office asking them to confirm when they will need a desk in the next week.

As the normal employee doesnt get involved in desk planning I want them simply to state whether they will be in the building or not by entering "GH" (our building) in a cell under each day in the email they get sent.

When the reply comes in we select the cells from the email and then paste them into the desk planning spreadsheet.
-----

WHAT I NEED TO DO:
Select some cells (must be in the same row - that we have just pasted in).
Press a button on the Worksheet labelled "Auto Assign Desk", which does this:-
For each cell that contains "GH", replace with the right-most cell to the left of the selection that starts "GH_"... (this is the start of a unique desk reference (GH_1_1, GH_1_2,etc.)
-----

This will assign the employee to the desk they were sat at last, when they are in the office next week.

## Search For Text Within Cell Then Return Contents Of That Cell?

Jun 19, 2014

So right now I have a spreadsheet that looks something like this:

A
B
C
D

[Code]....

As you can see, the stock names are slightly different in columns A & C (CORP. vs CORP, CO vs CO., etc). I need a formula in column D that searches column A for the first word in column C, and then retrieves the contents of that cell. I want to do this because I will then use a vlookup in column E to get the ticker for the stock.

Right now I have: =IF(ISERROR(SEARCH(LEFT(C1,FIND(" ",C1)),A:A,1)),A:A,"")

This formula searches column A for EXXON, but does not return the contents of the cell. Instead, it returns the contents of a different cell in the column.

## Google Image Search From Cell Contents Of Excel File?

Apr 5, 2014

i have an excel file with hundreds of rows of product codes which i need to download images for. is there a way this can be done directly from excel? basically if cell A1 has product name and Cell B1 have product code, id like Cell C1 to generate a link that will use the contents of B1 as the basis of my google image search. can this be created using a macro?

## Return Contents Of 1 Cell Based On Contents Of Another Cell?

Mar 12, 2014

I thought this was a pretty simple formula but I am having difficulty creating it. I am attaching a little test spreadsheet. Sheet 1 is where the data will be entered. The Reimbursed column has a drop down choice of yes or no. The next 2 columns are the cost of registration and the cost of accommodations. On sheet 2 is where I would like the formulas. So in cell A4 I would like a formula that says if B3 on sheet 1 is Yes populate this cell with the contents of Cell C3 only, B4 of sheet 2 would then be B3 if A3 on sheet 3 is Yes and so on with the Not reinbursed if sheet 1 the Reimbursed column is no.

## Find Function Where Search Criteria Isn't Exact Match For Cell Contents

Dec 19, 2011

I am new to VBA and am having difficulties in getting a find function to successfully locate search criteria within cell. When the search criteria matches exactly that of the cell contents then the code works; however should the search criteria only form part of the total cell contents (such as a seach for "the" in a cell containing "the cat sat on the mat") the code doesn't recognise it.

Essentially, I need the code to search a range for the required string and if found within a cell activate that cell and populate a combobox with the full cell contents of the activecell.offset(0,-2).

The relevant section of code attached below:

Dim role_count as range
Dim role as string

If Application.WorksheetFunction.CountIf(Range("Role_Count"), Role) 0 Then
Range("role_count").Select
Selection.Find(What:=Role, After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
, SearchFormat:=False).Activate

Me.Controls(ComboBoxName) = ActiveCell.Offset(0, -2).Value

## Link Search Box With VLookup To Provide Search Result

Jul 15, 2012

What i have so far is:
-3 Sheets (Sheet1 - Search, Sheet2 - Data, Sheet3 - Result)
-Sheet1 has a userform ready to link up - this opens up when workbook and worksheet is activated.
-Sheet2 has some example data to search - the search is for column 1 (see attachment)
-Sheet3 has a template ready for the data to be pasted to.

I would like the search result is column 1 to copy the data from columns 1 to 7 to sheet3.

I want the template/layout to remain after the pasting of results. (everything protected from editing, if possible).

Once finished (ie go back to sheet1, i want the data from sheet3 to be cleared.)

## Getting Different Result According To Contents Of Columns

Jul 3, 2012

I am trying to get result in a column based on contents of previous 4 columns. For example as per table below, if there is value 1 in either of first 4 columns of same row, I want to display A in column 5. As first 4 columns in row 2 to 4 contains 1, result is A. If there is any 2 in first 4 columns, I want to display B. If there are both 1 and 2 in any first 4 columns, I want to display C. If there is 3 in any of first 4 columns, I want to display D. And if all 1, 2 and 3 are in any of first 4 columns, I want to display E.

NY1
NY2
NY3

[Code]....

## Get A Cell To Look At A Row Based On Contents

Dec 24, 2008

I want to have a cell that looks at another cell based on a number that is in another cell. So imagine if you will: A1 contains the number 25. A2 contains the formula I can't work out. I want it to look at the row that is the number contained in cell A1, so in this case it would look at row 25.

Now I want to narrow it down further to a cell in that row but this will be a constant so lets say column F. So if A1=25 then A2 would display what ever is in F25. If cell A1 were 16 it would display the contents of F16 etc. The best I got was something like =IF(A1=>1,(F(A1))) but obviously that is wrong as it doesn't work.

## Add Row Based On Cell Contents

Apr 25, 2006

I want to add a row underneath a row if the value in the in B cell is not = "". Then i want to write a value in the C cell of the new row.

## Text Search Returns Cell Text Contents Of Different Column In The Same Row

Jun 7, 2007

Search a worksheet for a user defined text string, and have excell return the contents of a predetermined column in the same row in which the text string was found.

A prepopulated worksheet has the text "gold" entered in cell T278.

1. user searches for "yellow_metal"
2. Excell finds "yellow_metal" in row 278, say in cell A278.
3. Excell then goes to predetermined column (programed as part of macro or VB), say "T", and returns the text contents of the cell in that column, T278 in this example.
4. Excell returns "gold"

## Workaround For Public Variable Bug: Creates Different Cell Colors Based Upon The Cell Contents

Oct 15, 2008

I am in the process of reformatting an excel workbook to act as a review tool for different factors in a process. Part of my redesign includes the use of coding that creates different cell colors based upon the cell contents. The new workbooks will be used to handle existing data for this year. I have developed a process macro to open an existing workbook and copy and transfer the original data worksheet into the newly formatted workbook. The data gets transferred to the new worksheet and the resulting workbook is renamed and saved, Heres'' the rub... the newly saved workbook is missing all of the coding for the worksheets... apparently this is a MS bug.

Has anyone figured a workaround for this. One thought I had is to open both( new and old )workbooks and rather than move/copy , i would transfer the data using cell references.

## Macro That Will Clear Contents Of Cell Based On Format Of Text In Adjacent Cell

Feb 18, 2009

Been racking brain, searching through the forum here, and my Excel 2003 Bible all day trying to figure out this problem to no avail. I would like to clear the contents of any cell in a given range if the cell immediately to the right of is formatted as bold.

## Automatically Update A Protected Cell Based On Contents Of An Unprotected Cell

Apr 30, 2009

I am trying to find some VBA that will allow protected cells to be updated when a user enters or selects data in other cells.

For example:

Cell 'A1' starts out blank.
Cell 'B1' has a drop down to select specific items.
Cell 'C1' is the date of the order and is a locked cell.
Cell 'D1' is the date of completion and is a locked cell.
The worksheet is protected to prevent direct changes to cells C1 and D1.

If a user enters any information in A1, then C1 displays the current date.
If a user selects 'Complete' from the drop-down list in B1, then D1 displays the current date. Both of these actions are independant of one another. This format is the same for every cell in the 4 columns indicated above. I thought I was able to do this in another spreadsheet I created a year or so ago but I have not been able to figure out what I did and I do not have the spreadsheet to look at.

## Replace Cell Contents Based On Matching Data In Another Cell (On Another Sheet)?

Apr 28, 2014

I am working with a spreadsheet that has our user data; User(First) Name, User(Last) name, Computer Name, MAC address, Phone Number, Seating Position and Network Port Number.

I have let this get horribly out of sync, moved computers around, and moved them while the MAC address column was hidden, As a result, I have a bunch of users listed as being at the wrong computer. I have a second spreadsheet I generated that gives me the logged in user for about 2/3 of my computers, with the computer name(Just 2 columns, 'A' and 'B'. I would like to have Excel match the computer name and then overwrite the user name. For example, if the first computer in my correct user list is DELL-99945ty2, and the user name is "Jimbo Jones", I would like it to search the first Excel doc(The one with all of the user data), and replace the user name with "Jimbo Jones". Is this simple and straightforward?

In my main spreadsheet, the user name is in column B and the computer name is in column G, So I want to use the values from Column B in my second document to find its match in Column G of the first spreadsheet, and then replace the data in Column B with Column A in the first spreadsheet.

## Worksheet Name Based On Contents Of Cell

Oct 13, 2013

Is it possible to dynamically chance the name of at a worksheet that already exists based on the contents of a cell on another sheet?

I.e. If the name of a sheet is linked to the value of the Cell A1 in the "Data" sheet and I change A1 to read "Group1" it changes the name of the sheet as well?

## Contents Of Cells Appear Based On Another Cell

Dec 14, 2013

I am working on a sheet where I want the contents of cells D1:D10 appear if cell A1 has a text in it and the contents of cells D1:D10 disappear if cell A1 is blank. What is the right conditional formatting formula for this.

## Lock Row Based On Cell Contents

Oct 17, 2008

I wish to be able to lock an entire row after an entry has been made in a certain cell.

e.g. let's say i want to lock row 9 in its' entirety following entry of "Yes" in cell G9. If there is no entry in G9 the the entire row should be still unlocked. Likewise with any row with a corresponding entry in column G.

## Print Based On Cell Contents

Aug 28, 2009

I have put together a spreadsheet to help with the creation of work orders. I have a summary page that the user can define which category the work order falls under along with this I have a couple of macros set up that will print a specific work order pertaining to the category they selected. I have run in to a few problems (mostly training users) that I would like to eliminate up front.

I am looking for a macro that I can use to look at the contents of a cell (contains a word that corresponds directly to the name of one of the sheets in the work book) and print the worksheet that has the same name as the contents in the referenced cell.

## Sound Based On A Cell Contents

Jan 11, 2010

I have thousands of items each with a unique barcode(column A) and each is catorgorized either KEEP or DISCARD (column B). What I want to do is scan the barcode (column A), Vlookup and return KEEP or DISCARD (column B). Now based on what the vlookup returns can I have a sound file play for KEEP and a different one for DISCARD.

## Change Result Cell Format Based On Input Cell Value

Mar 24, 2007

Macro Based on an input cell’s (e.g. B12) setting of “yes” or “no”, format several other cells (e.g. B20:G20, B23:F23, C26:J26) as follows: keep the existing yellow shading if input cell is “yes”, change to grey shading if input cell is “no”. I would like this macro to run automatically whenever the input cell value is changed.

## Lock / Unlock Excel Cell Based On Contents Of Another Cell?

Sep 12, 2013

How to Lock/Unlock an Excel Cell Based on the Contents of Another Cell?

## Setup Dependent Cell Based On Contents Of Independent Cell

Oct 20, 2013

I'm trying to set up a dependent cell (B) based on what is in the independent cell (A)

If A is blank, B should be blank

If A has any value other than X, B should display a set string Y

If A contains X, B should contain a drop down list with a range of choices.

I've tried setting it up as a dependent validation cell and I've tried using OFFSET, but the best I can do is to get three different drop down lists to populate cell B. One with only string Y, one with only a blank, and one with the range of choices. The problem is in the first two cases above, I want the cell to fill automatically with either blank or string Y -- I don't want them to just be drop down options, with the cell displaying the last value that was input.