Highlight a cell if its copied to another sheet - vba

I have a formula that will copy values from one column on Sheet B to another column on another Sheet A. What I'd like to do is highlight the cells that were copied on Sheet B and highlight the cells in Sheet A that are not on Sheet B, essentially the inverse of the first part. On Sheet B only columns G and H would be highlighted but Sheet A could be from column A to H.
=IFERROR(INDEX(Sheet2!G$3:G$7,MATCH(1,INDEX((Sheet2!$D$3:$D$7=$A3)*(Sheet2!$B$3:‌​$B$7=$C3),),0)),G3)

You could set up conditional formatting with the same logic to change the colour or either the cell that you are setting or the one that you are copying from.
Beware: this kind of code can make your spreadsheet very slow if over used.
So in one range (sheet 2) , you would have conditional formatting set up to highlight the cell if
this match failed
MATCH(1,INDEX((Sheet2!$D$3:$D$7=$A3)*(Sheet2!$B$3:‌​$B$7=$C3),),0)
In the other range (sheet 1 a:h)
you would highlight if ISERROR(INDEX(Sheet2!G$3:G$7,MATCH(1,INDEX((Sheet2!$D$3:$D$7=$A3)*(Sheet2!$B$3:‌​$B$7=$C3),),0)))
has picked the value from sheet2
I may have incorrectly butchered your code, but you should get the idea. Where you currently have a range of values, select the range, insert the conditional formatting, but edit the range to only check the first cell, it will automatically increment for you (if you remove the appropriate $ signs)
conditional formatting intro

Related

Google spreadsheet Conditional Formatting rows depending on dates on current and another sheet

So I have Sheet1 and Sheet2 (in one spreadsheet) where:
Sheet1 contains data from A:E
Sheet2 contains data from A:K
I need to lookup the Sheet1 B cells text in Sheet2 A cells and return Sheet2 J column value (which contains dates) and if Sheet2 date < TODAY then conditional formatting should apply.
I used this formula for conditional formatting:
VLOOKUP($B:$B,Sheet2!$A:$K,10,0)<TODAY()
This works well if I want to use it just to show the values but conditonal formatting are not applying to cells
Update:
I tried it with a simpler function. I have added the dates to the F column and used the following conditional formatting formula:
F:F<TODAY()
Still doesn't work.
PS: I made sure the formats are set to DATE where DATEs are present.
Try INDIRECT function according to advanced conditional formatting description:
Note: Formulas can only reference the same sheet, using standard
notation "(='sheetname'!cell)." To reference another sheet in the
formula, use the INDIRECT function.

VBA: Highlight a row with a specific column value

I am working on a very large excel 2010 workbook with several sheets.
One of the sheets is called "RatePlan" and one of the columns in this sheet is "RatePlanCde".
Some of these "RatePlanCde" (a total of 2514) are not valid anymore and have been highlighted in Red.
I need to find if "RatePlanCde" column exists in any other sheets. If so, then highlight the row with the invalid "RatePlanCde" value in all the sheets in Red too.
Can this be done using a VBA script and how?
Formula for conditional formatting is a simple VLookup
The following formula assumes that the codes in the "other" sheets is in Col A, the codes are in the Rateplan-Sheet in Col C and the "INVALID"-marker in COl D:
=VLOOKUP(A2;RatePlan!$C$2:$D2515;2;FALSE)="INVALID"

Search column in one Excel workbook to paste Adjacent Cell's Value into active VBA script

I have Workbook1 and Workbook2 and need to search column A in Workbook1 for specific string value and then copy adjacent cell that is in column B of Workbook1 to the macro being run where I need to insert the value in the following formula in VBA script: =(ROUNDUP((F2+40)/[VALUE],0))*[VALUE]. The [VALUE] = the value taken from the adjacent cell in column B from Workbook1. Workbook2 is where the macro is running on.
I am being rushed at the moment and if this is not clear enough. I will come back and clarify as needed.
VALUE = WorksheetFunction.VLookup(theString, Workbooks("Workbook1").Worksheets("Sheet1").Range("A:B"), 2)

Comparing 2 excel sheets and returning a data

I'm trying to compare two Excel sheets, Sheet1 column O to Sheet2 column A:M, if it found a match, it will copy Sheet 2 "down cell of matched data" (ie match data A3, copy A4) then paste to Sheet 1 column R. I'm (very) new to VBA and Macros so I don't know how to do this. Thanks in advance!
In sheet 1 of column O - datas are USD,JPY,TWD, etc. In sheet 2 column A to M, a specified exchange rate per currency. If sheet 1 column O data is USD, it will search in Sheet 2 with matching "USD"; if cell A3's data is USD, the exchange rate is in cell A4 which will be copied and pasted into column R of Sheet 1 corresponding to the row of USD.
So what I'm dealing with is something kind of like this:
This is what I’m looking for after the macro
Since Sheet 1’s cell O1 matches Sheet 2’s cell A3, I want it to return Sheet 2’s cell A4’ s value and paste it to corresponding row of Sheet 1’s cell R1.
Let me know if this makes sense or if you need further clarification.
Thanks!
Most of the code you need you can manage by yourself using macro recorder:
Start recording new macro
Select cell O1
Copy selected cell (by pressing RMB or ctrl+C)
Go to Sheet2
Select your data (A3:M7) with mouse
Press ctrl+F to open "Find" window
Paste value of copied cell
Press Enter. Cell with searched value should be selected
Press down arrow to move selection one cell down
Copy value from selected cell
Go to Sheet1
Press right arrow to move to column R
Paste copied value
Stop recording the macro
After that you need to find how to use For loops and add it to your code. Good luck!

How can i compare the data from a sheet to another?

As I have some columns with data in sheet 1 & the same column with approx. same data except some in sheet2 .So I want to compare the data from sheet1 to sheet2 & it should show something what will be easy that data is "Differ" on those cells from sheet1 to sheet2 .
By anyway I want to know where the data are different.
Lets assume your first sheet is Sheet1 and the 2nd is Sheet2,
Go to the cell a1 on Sheet2 and on home ribbon select conditional formatting -> highlight cells rules -> equal to -> and on the open window, enter the formula:
='Sheet1'!A1
press apply.
Now use the format painter brush when you are on the same cell on select all the range you have.
you can choose the color you wish to distinguish between the equal cells with non equal cells on the 'with' on the opened window