Is there any way to mark/block certain column/row by using the formula in Microsoft Excel?
e.g. i wanna copy only the odd rows and it takes me a long time to copy/paste it one by one.
Add a column to your sheet with below formula:
= MOD(Row(); 2)
Now You can Filter that row to 1 for odd rows and then copy your data.
An alternative that avoids a delimiter that might not suit your locale is:
=ISODD(ROW())
in a spare column copied down to suit. Then filter that column to select TRUE and copy what's visible.
Related
I have an excel datasheet with a column of 30 cells (A1:A30) that fills up automatically and randomly, so that some of the cells contain data and some don't.
I need to create a new list in the next column (b1:b30) containing only the data and no duplicates, but once the cells are filled I can't touch the datasheet so I can't use sorting, and sadly I work in an environment where macros aren't enabled so no VBA.
So far this is what I've come up with:
B1=IF(A1=0,IF(A2=0,...,IF(A29=0,A30,A29),A28),A27),...A2),A1)
And then
B2=IF(A1=OR(0,B1),IF(A2=OR(0,B1),...
And so on until by B30 I get an expression so horrifying it literally have me a nightmare.
It's there an easier way?
Thanks in advance
If you have access to the new Dynamic Array formulas UNIQUE and FILTER:
=UNIQUE(FILTER(A1:A30,A1:A30<>""))
Put that in B1 and Excel will spill down the list.
If one does not have access to those formula then put this in B1 and copy down:
=IFERROR(INDEX(A:A,AGGREGATE(15,7,ROW($A$1:$A$30)/(ROW($A$1:$A$30)=MATCH($A$1:$A$30,A:A,0)),ROW(A1))),"")
I have a table filled with hundreds of values in different cells (not coming in order, chaotic). Now I want to add 20% to each value (=x*1.2).
what formula should I use?
A quick way to get the desired result is to add a new table or worksheet and copy the update formula in each cell (e.g =A1*1.2). You could then overwrite the old values by pasting the new values. Pasting values overwrites any old formula.
If you want to manipulate the formula of every cell, you should look into a vba solution.
This is my solution:
1. Write a 1.2 in an empty cell out of table.
2. Copy this cell (1.2).
3. Select the table with values. Right-click of the mouse, select Paste Special -> Paste Special..-> Multiply. Voila!
Result: all selected values in the table were multiplied by 20%
Thanks a lot to my colleague Lina!
I am attempting to use an IF statement to check whether the sum of two cells from another Excel sheet is greater than or equal to 1.
For a sheet called Test1 with the values of interest in column C, this is what I have so far, which works fine:
=IF((Test1!C1+Test1!C2>=1),1,0)
In column B on a second sheet that I'll call Test2, I want to copy this formula down 200,000 rows. However, if the aforementioned formula is in cell B1, for the formula in B2 I would like the formula to read:
=IF((Test1!C3+Test1!C4>=1),1,0)
I want to copy the formula down the column so that the second cell reference in the formula in the first row does not become the first cell reference in the formula in the second row (eg. it would go C1+C2, then C3+C4, C5+C6, etc.).
I have tried manually entering the formula for a few rows, highlighting those, and copying them down but can't get the desired cell reference pattern. If I highlight and drag these first three formulae down another three rows, C4 and C5 are repeated and not in the correct pair.
=IF((Test1!C1+Test1!C2>=1),1,0)
=IF((Test1!C3+Test1!C4>=1),1,0)
=IF((Test1!C5+Test1!C6>=1),1,0)
=IF((Test1!C4+Test1!C5>=1),1,0)
=IF((Test1!C6+Test1!C7>=1),1,0)
=IF((Test1!C8+Test1!C9>=1),1,0)
I have tried using OFFSET() within this formula but couldn't get it to work. I am basically just wanting to add 1 to each of the cell references in the formula, as compared to the previous row (but not to actually add 1 to the value of that cell, as would happen with C1+1 for example).
Any insight would be greatly appreciated!
If you plan on copying this down 200K rows then you will want the absolute simplest formula that accomplishes the stagger. Avoid the volatile OFFSET function or be prepared to spend a lot of time waiting for random calculation cycles to complete. A volatile function will recalculate whenever anything in the workbook changes; not just when something changes that involved the formula in the cell.
=--(SUM(INDEX(Test1!C:C, (ROW(1:1)-1)*2+1), INDEX(Test1!C:C, (ROW(1:1)-1)*2+2))>=1)
The following formula should do the trick:
=(SUM(INDIRECT("C"&ROW()*2-1);INDIRECT("C"&ROW()*2))>=1)*1
And that's the version using IF:
=IF(SUM(INDIRECT("C"&ZEILE()*2-1);INDIRECT("C"&ROW()*2))>=1;1;0)
You say I am basically just wanting to add '1' to each of the cell references in the formula but appear to be incrementing by 2, so I am confused but an option might be to apply you existing formula to 400,000 rows, together with =ISODD(ROW()) in another column, then filter on that other column to select and delete those showing FALSE.
Excel's autofill won't do the 2-cell shift that you're looking for. You can use the functionality that is there.
Put =IF((Test1!C1+Test1!C2>=1),1,0) in the top cell and drag a copy to the second row (it will be =IF((Test1!C2+Test1!C3>=1),1,0) but that's okay). Now, put 'A' and 'B' in the next column. Select all 4 cells and copy them down 400k rows.
Use filter to delete rows flagged with 'B' and delete the blank rows.
(Select blank rows with [F5] click Special and select Blanks, then right-click and delete)
Here is all you need. It's fast and nonvolatile.
=--(SUM(INDEX(Test1!C:C,ROW(1:1)*2-2):INDEX(Test1!C:C,ROW(2:2)*2-2))>=1)
Copy it down as far as you like.
I have an array of numbers in Excel spanning from Cells B1 to F49. Out of all those numbers I want to find out the unique values, in other words, no duplicates. I tried using Remove duplicates but it looks at the rows and not the individual cells. What would be my best option for doing this? any help would be greatly appreciated.
You could try this array formula that returns unique text or numbers from a rectangular range.
Select a range to output the results to eg: H1:H245
Copy and paste the formula below into the formula bar.
Press Ctrl+Shift+Enter to enter into the range.
=IFERROR(CELL("Contents",INDIRECT(T(IF(1,TEXT(MODE.MULT(IF(FREQUENCY(COUNTIF(B1:F49,"<="&B1:F49)+ISTEXT(B1:F49)*COUNT(B1:F49),COUNTIF(B1:F49,"<="&B1:F49)+ISTEXT(B1:F49)*COUNT(B1:F49))>={1,1},MODE.MULT(10^5*ROW(B1:F49)+COLUMN(B1:F49),10^5*ROW(B1:F49)+COLUMN(B1:F49)))),"r0c00000"))),0)),"")
I'd probably put this formula in column C: (or another empty column you have):
(so starting in cell C1: )
=COUNTIF(B:B,B1)=1
(and copy/paste the formula down)
It will return TRUE if it is unique. So you can then filter things out via Filter, or with other formulas down the road.
It may be easiest to just combine your information into one long column and run a remove duplicates. If this is not an option you may want to look at writing a macro to crawl through the records.
You could have a macro go through each column for the rows specified and determine if the CountIf function =COUNTIF(B2:F49,B2) returns a value >1
if it does there are at least 2 instances of this number.
I'm not sure how you want to identify your unique cells but you could potentially set a text color or return the values of the cell to another location.
Simplest for identification of values unique within the entire array may be to highlight the entire range with ‘standard’ formatting of choice for uniques, then select the entire range, Conditional Formatting, Highlight Cell Rules, Duplicate Values…, and choose a custom format of no fill and font of whatever you started with.
Does anyone know how I can quickly hide/remove all rows in sheet1 that contain any of the rows info from sheet2?
It would need to contains filter as it wouldn't be an exact match.
For example
Sheet1:
http://www.google.com/something/else
http://www.yahoo.com/whatever
www.microsoft.com/hahha
Sheet2:
google.com
So the end result would be the first line in Sheet1 would be hidden
In practice I'm working with thousands of rows in sheet1 and around in Sheet2.
To clarify, I'm essentially trying to do a contains filter with more than 2 values - the default filter only allows 2 values.
Also I am working with Excel for Mac 2011.
You can do this quickly with a simple helper column without a large range loop.
For simplicity as a sample:
Assuming your Sheet 1 list was in A1:A1000
your Sheet 2 partial list was in C1:C5 (on the same sheet for the picture below)
then in range B1:B1000 enter this array formula,
=MAX(IF(ISERROR(FIND($C$1:$C$5,A1)),0,1))=1
(Enter as an array formula by pressing Ctrl+Shift+Enter)
Then AutoFilter the TRUErows (which flag any matches) and hide them
As i was reading the solution posted by #brettdj I think it should work for your problem.
From your comment it seems you have an empty cell problem when using his solution. Are you sure you replaced the $C$1 : $c$5 with the right values?
In your case you should first refer to the right sheet (Sheet2 if you didn't rename it) then the right column (assuming you have it in column A of sheet2).
You should write =MAX(IF(ISERROR(FIND(sheet2!$A$1:$A$5,sheet1!A1)),0,1))=1.