I have two columns in an excel worksheet. I want to filter where the two columns are different. Any advice?
or even more simply put this in the third column
=A1=B1
You could add a calculated column like =A2=B2 and filter for FALSE on that column.
Here's an alternative that only requires formatting the differences...
1) Select the two columns you want to compare and press [Ctrl+\] (or goto special|row differences). If you want to remove the column heading from the selection press [Ctrl+Shift+\] (or goto special|column differences). See example below
2) Format the selected cells with a font color then right-click the selected cell and choose Filter > Filter by selected cell's font color:
Put this in a third column
=if(A1=B1,1,0)
filter where that thridcolumn=0
Related
I am building a residential stacking plan in which each cell = unit type with specific color given conditional formatting.
2 tables follow below for each unit reflect a sqm size and a $ value.
I need to reflect only the cells' color into the following tables.
I need a dynamic solution and would prefer avoiding vba (since I'm not proficient), but will use if necessary. Thanks in advance!
Find Image HERE
Set up your Conditional formatting as normal on the first table like this:
Note my table starts at cell C4 but yours is in a different place and should be adjusted accordingly. make sure you DON'T have the $ symbol on the formula in the rule but you do have it on the 'Applies to' section
Now copy and paste this formatting onto the second table.
Finally edit the formulas in the conditional formatting so that they point to the starting cell of the FIRST table. It should look like this:
Note that the formatting 'Applies to' the second table but refers in the Formula to the values in the first table.
The result is this:
You can repeat this for other tables if you need to.
As you are working in Excel 2003(!), follow the following steps:
Select the cells in the second table.
In the menu, choose Format - Conditional Formatting.
In the Conditional Formatting box, choose Formula Is.
In the text box, enter the cell reference of the FIRST table (eg C4="4+"), do not enter any $ symbols.
Click the Format button and select the background fill to match the one in the first table.
Add the other conditions in the same way by clicking the Add>> button.
If you change the color code values (B21:B26) from 2 rooms to 2 (to match your second table), the following should do the trick. Basically, this code is not using conditional formating. Getting the color from conditional formating can be somewhat laborious and tricky (google "excel vba find color conditional formatting"). Instead, the present code reads the color in your Color Code cells, and apply it to the other two ranges.
Private Sub BckgndColor()
Dim ColorCodeRange As Range
Dim NoOfRooms As Range
Dim CellColorIndex As Integer
Dim c As Range
Dim d As Object
Set ColorCodeRange = Worksheets("Sheet1").Range("B21:B26")
Set d = CreateObject("scripting.dictionary")
'Add the pairs (value, color) to dictionary
For Each c In ColorCodeRange.Cells
d.Add c.Value, c.Interior.ColorIndex
Next
Set NoOfRooms = Worksheets("Sheet1").Range("M25:V36") 'Here the range of Table 2 (M25:V36 in your example)
'Scan range, and assign color
For Each c In NoOfRooms.Cells
If d.Exists(c.Value) Then
c.Interior.ColorIndex = d(c.Value)
c.Offset(16, 0).Interior.ColorIndex = d(c.Value) 'If Table 3 is always 16 rows down, this shoud work
End If
Next
Set d = Nothing
End Sub
I gave the option data validation list in sheet 2, while I selecting the option by list the cells will change . for that cells I want to get color also from source table in sheet1 to sheet2 .
My requirement is very simple but i am not finding it easy-
In excel, column A is having 'Table name' and column B is having 'Column name'
I want to write a query-
Select * from 'column A' where 'column B' is not null.
In excel I have 2578 lines so I dont want to write 2578 Select statements.
any expert help in Excel?
I doubt this is your answer, but may help towards what you want. Based on #user3514930's approach:
With data as in the top left corner, select the two columns and click on DATA > Sort & Filter - Filter. Click on the arrow in the Column name cell and on (Blanks) in the dropdown. You should then see the equivalent of what is in the lower range. This can be copied and pasted elsewhere in the sheet, if you wish.
I have a spreadsheet where the first column contains the text "user_#" in each row.
I need to replace the "#" in each row and rep[lace it with the row number such that
user_1
user_2
user_3
'
'
'
user_n
Is there a simple function that I can plug into the first row and then copy and drag so that each row will be filled in correctly?
you could simply have the text "user 1" in the first row and drag down then column. You need to choose the fill type to "fill series" in the "Auto Fill Options" box which appears when you drag down the column
Use this, where B3 is a cell on the same row as the one where you're putting this formula.
=CONCATENATE("USER_",ROW(B3))
Also, you can ="USER_"&ROW(B3) as an alternative. If you need a special format, like integer, you can make sure you get what you want by using this ="USER_"&TEXT(ROW(B3),"#"). Of course, this might be too much if you are using ROW(). I just added it in in case you wanted to reference a non-integer value.
Is it possible to clear a large number of cells contents based on color alone? I don't think that simply filtering is going to work well on this because the dataset is large and 'wide'
If you don't need this done programatically, it can be faster to just use Find and Replace (Ctrl-H).
Press Ctrl-H
Click Options > >
Click the top Format... button to search for for colored cells (use the Fill tab)
Leave the Replace with field blank to delete the contents of cells with the format you specified.
This will clear the content of any cell within the range A1:G8 filled with yellow (65535). Change the color for your color and the range for your range. This is kind of crude, sorry.
Sub Macro1()
Range("A1:G8").Select
For Each Cell In Selection
If Cell.Interior.Color = Excel.XlRgbColor.rgbYellow Then
Cell.Clear
End If
Next
End Sub
You can clear cells by background color using Excel's filter options.
For Excel 2013 & 2010
Open a worksheet where each column has a header row.
Enable column filtering with Data -> Sort & Filter -> Filter
Click the drop-down-arrow on a column, go to Filter by Color, and select a color you want to view. (Any non-colored cells will be hidden)
Select the remaining cells, right-click and select Clear Contents.
To unhide the remaining cells, disable column filtering with Data -> Sort & Filter -> Filter
I have a column with some text in each cell.
I want to add some text, for example "X", at the start of all cells. For example:
A B
----- >>>> ----
1 X1
2 X2
3 X3
What is the easiest way to do this?
Type this in cell B1, and copy down...
="X"&A1
This would also work:
=CONCATENATE("X",A1)
And here's one of many ways to do this in VBA (Disclaimer: I don't code in VBA very often!):
Sub AddX()
Dim i As Long
With ActiveSheet
For i = 1 To .Range("A65536").End(xlUp).Row Step 1
.Cells(i, 2).Value = "X" & Trim(Str(.Cells(i, 1).Value))
Next i
End With
End Sub
Select the cell you want to be like this,
Go To Cell Properties (or CTRL 1)
under Number tab
in custom
enter
"X"#
Select the cell you want to be like this, go to cell properties (or CTRL 1) under Number tab in custom enter "X"#
Put a space between " and # if needed
Select the cell you want,
Go To Format Cells (or CTRL+1),
Select the "custom" Tab, enter your required format like : "X"#
use a space if needed.
for example, I needed to insert the word "Hours" beside my numbers and used this format : # "hours"
Enter the function of = CONCATENATE("X",A1) in one cell other than A say D
Click the Cell D1, and drag the fill handle across the range that you want to fill.All the cells should have been added the specific prefix text.
You can see the changes made to the repective cells.
Option 1:
select the cell(s), under formatting/number/custom formatting, type in
"BOB" General
now you have a prefix "BOB" next to numbers, dates, booleans, but not next to TEXTs
Option2:
As before, but use the following format
_ "BOB" #_
now you have a prefix BOB, this works even if the cell contained text
Cheers, Sudhi
Michael.. if its just for formatting then you can format the cell to append any value.
Just right click and select Format Cell on the context menu, select custom and then specify type as you wish... for above example it would be X0. Here 'X' is the prefix and 0 is the numeric after.
Hope this helps..
Cheers...
Go to Format Cells - Custom. Type the required format into the list first. To prefix "0" before the text characters in an Excel column, use the Format 0####. Remember, use the character "#" equal to the maximum number of digits in a cell of that column. For e.g., if there are 4 cells in a column with the entries - 123, 333, 5665, 7 - use the formula 0####. Reason - A single # refers to reference of just one digit.
Another way to do this:
Put your prefix in one column say column A in excel
Put the values to which you want to add prefix in another column say column B in excel
In Column C, use this formula;
"C1=A1&B1"
Copy all the values in column C and paste it again in the same selection but as values only.
Type a value in one cell (EX:B4 CELL). For temporary use this formula in other cell (once done delete it). =CONCAT(XY,B4) . click and drag till the value you need. Copy the whole column and right click paste only values (second option).
I tried and it's working as expected.