I have a excel sheet(csv) like this one:
and I want the output(tab delimited) to be like this:
Basically:
replace duplicates with blanks but
if col6 value is different from the previous row for the same
col1
value, all the data fields should be included.
I am struggling to create a formula which would do this.
If I try to "Remove Duplicates" it removes the value and shifts the values up one row. I want it to remove the duplicates but not shift the values up.
Given that duplicate data cells are next to each other
and data are on column A with blank top row, this should work. It will remove duplicates except the first occurrence.
=IF(A1=A2,"",A2)
=IF(A2=A3,"",A3)
.
.
.
Try this (note, you need a blank top row (edit: Actually, you're fine you have a header row)):
=IF(A2<>A1,A2,IF(D2<>D1,A2,""))
=IF(A2<>A1,B2,IF(D2<>D1,B2,""))
=IF(A2<>A1,C2,IF(D2<>D1,C2,""))
etc
in the top row and drag down
Edit: Noticed you needed an additional condition.
Try this
=IF((COUNTIF(A1:A$203,A1))=1,A1,"")
It will count duplicates and for the last count it will keep value.
Try COUNTIF(A1:A$203,A1) and you should be good to understand the logic.
You asked for a formula? I suppose you could do something like this. Although it might be easier to use a macro:
=IF(COUNTIF($A$2:A6,"=" & A7),"",A7)
You could have a duplicate table on a separate tab using this formula to clear the rows you don't need - or however you want. Good Luck.
There is another way that doesn't involve a helper column... conditional formatting.
Highlight A2:G(whatever the last cell is)
Use a formula to decide which cells to highlight
Formula would be =AND($A2=$A1,$F2=$F1)
Set the format to be white text (or equal to whatever you have the background color)
Related
I am trying to autofill cells with functions by dragging the first function I have down a lot of cells.
Currently, I have this function:
=IF(A30=A2,A2,"")
and when I drag, it becomes this:
=IF(A31=A3,A3,"")
but I want this:
=IF(A31=A2,A2,"")
I tried typing in a view previous boxes and then dragging the formula, however, then it just jumps to totally different conclusions that I don't want.
I also have a similar issue where I am copy pasting formulas, and I want it to keep the same column for one value, but not for the other:
Copied:
=IF(N7="","",B6)
Pasted Result:
=IF(P7="","",D6)
Wanted Pasted Result:
=IF(P7="","",B6)
Anything would help. Otherwise, I have to go through 40 columns by 200 rows by hand. Thanks!
You can add $ signs before the column and/or the row to achieve what you want. Your first example:
=IF(A31=A$2, A$2, "")
Try locking the row of the original A2 with a $ like A$2.
=IF(A30=A$2, A$2, "")
This is known as an absolute row, relative column. When dragged right column A will still shift to column B, column C, etc unless you lock the column as absolute as well (e.g. $A$2).
I want to find similar data in Excel cell based on characters for example in one column I have ABCDEF and another column I have DEAFBC, so in this case both cell contains characters abcdef, any solution to match?
I tried like, similar, partial match options in Excel which didn't meet my results.
Separate each letter into it's own cell (text to columns, fixed width). Copy to a new column first if you want to keep the original data.
Sort each row (this is a little tricky, but it is possible - see my example.)
Combine the cells again by just stitching them together using &.
You can now sort to easily see duplicates or remove them etc.
The formula to paste into cell I2 in my example is:
=INDEX($B2:$G2, MIN(IF(SMALL(COUNTIF($B2:$G2, "<"&$B2:$G2), COLUMNS($H2:H2))=COUNTIF($B2:$G2, "<"&$B2:$G2), ROW($B2:$G2)-MIN(ROW($B2:$G2))+1)), MATCH(SMALL(COUNTIF($B2:$G2, "<"&$B2:$G2), COLUMNS($H2:H2)), COUNTIF($B2:$G2, "<"&INDEX($B2:$G2, MIN(IF(SMALL(COUNTIF($B2:$G2,"<"&$B2:$G2),COLUMNS($H2:H2))=COUNTIF($B2:$G2,"<"&$B2:$G2), ROW($B2:$G2)-MIN(ROW($B2:$G2))+1)), , 1)), 0), 1)
Make sure you hit Ctrl+Enter when exiting the cell, since this is an array formula.
I've got a little helper spreadsheet that I use, and there are some Merged Cells.
Rather than get rid of these, which I know can cause headaches, I was looking for an idea on fixing an issue.
I have a few rows that share a merged cell. When this merged cell is not empty, I want the rows to highlight. Currently, the formula (applied over A1:B4) is =$B1<>"" and then a fill. Works okay for the first row, but not the other three:
I was thinking I could add some more logic, but there's nothing really there for me. It's a pretty simple table. Unfortunately, there's not really a way to say (for rows 2:4), if row 1 is colored, then color this row...(Although I think I've seen clever uses of Named Ranges to do something like that, but I could be mistaken).
So, in A2, what's the conditional format formula "thinking"? Is it going to =$B2<>"", in which case ...what's it looking for as B2? If I select A2, and look at the conditional format rule applied to the current selection, it still shows =$B1<>"".
Thanks for any ideas/tips. It's not a huge deal, so I don't need a VBA solution - just maybe an idea or trick for using CF with merged cells.
Edit: For a more full explanation - the idea is that col. B will have an invoice number and if it's there, make the row a color. I will be repeating this "chart" a bunch, and have some non-grouped companies, who have their own lines. I just don't like the gap of color there in my group and was trying to get it to have a color when the first of the group does.
I usually try to base my CFR's on formulas.
After selecting all of column A and B I created a CF rule with the following.
=AND(LEN($A1), ISNUMBER(MATCH(1E+99, $B$1:$B1)))
The approximate MATCH function simply looks for the last number in the B column. I can see a missing invoice number in a cell like B7 would generate confusion but perhaps you can expand on this for conditions not demonstrated by your examples.
If you want to use "placeholder" instead of blank cells (when there is no invoice), you could try the following formula:
=(LOOKUP(2,1/($B$1:$B1<>""),$B$1:$B1)<>"x")*LEN(A1)
With sample data it looks like this:
When the cell is left blank (no placeholder), column A is highlighted, column B is not.
I'm hoping to use the replace tool or something similarly easy where I clear cells in a column that have a value of zero.
I know I could delete the cells using the filter tool, but is there a way to just clear cells with a zero value?
Or, in the 'else' clause of an 'if' statement is there a way to return a blank cell?
This would also give the result I want.
Without using a helper column to replace, and paste over, I would suggest selecting your range, and then a simple find/replace for 0 with (nothing in the "replace" box).
Edit: Do you want to remove them, or just hide them? You can also hide all 0 returns by choosing a custom cell format, and using 0;-0;;.
You can use
=if(something, value_if_true,"")
or do a find (0) and replace (by blank), checking the whole cell option checkbox, assuming your cells are values and not formulas.
I am having a lot of difficulty trying to come up with a way to 'parse' and 'order' my excel spreadsheet. What I essentially need to do is get the last non empty cell from every row and cut / paste it a new column.
I was wondering if there is an easy way to do this?
I appreciate any advice. Many thanks in advance!
Are your values numeric or text (or possibly both)?
For numbers get last value with this formula in Z2
=LOOKUP(9.99E+307,A2:Y2)
or for text....
=LOOKUP("zzz",A2:Y2)
or for either...
=LOOKUP(2,1/(A2:Y2<>""),A2:Y2)
all the formulas work whether you have blanks in the data or not......
Okay, from what you've given if I understood correctly, you can use this formula in cell J1 and drag it down for the other rows below this cell:
=INDEX(A1:I1,1,COUNTA(A1:I1))
This assumes that the 'longest row' goes up to the column I.
You can also use OFFSET. You don't need to specify an ending column, you can just reference the entire row.
=OFFSET(1:1,0,COUNTA(1:1)-1,1,1)