Excel column with duplicate values, return index value another column - excel

Here's my problem. I have a left column with some duplicate values in its rows. Column on right has an "index" on the the first same row where duplicate first appears on left.
How to find the duplicates on left, then return the values on right (empty), repeating the value on same right column corresponding to the left.
Simple sample attached. Need to populate B4-B6 with "B", and B8-B9 with "C".
It's a spreadsheet with about 20,000 lines.
Thanks!

You can use the following steps too.
Step 1
Select the range that contains blank cells you need to fill.
Step 2
Click Home > Find & Select > Go To Special…, and a Go To Special dialog box will appear, then check Blanks option.
Step 3
Click OK, and all of the blank cells have been selected. Then input the formula "=B3" into active cell B4 without changing the selection.
Step 4
Press Ctrl + Enter, Excel will copy the respective formula to all blank cells.
Step 5
At this point, the filled contents are formulas, and we need to convert the formals to values. Then select the whole range, copy it, and then press Ctrl + Alt + V to active the Paste Special… dialog box. Then select Values option from Paste, and select None option from Operation.
Step 6
Then click OK. And all of the formulas have been converted to values.

Use this simple if condition to resolve your Question
in coloumn C
A B C
1 Left Right Right
2 1 A =IF(B2="",C1,B2)-----> A
3 2 B =IF(B2="",C1,B2)-----> B
4 2 =IF(B2="",C1,B2)-----> B
5 2 =IF(B2="",C1,B2)-----> B
6 2 =IF(B2="",C1,B2)-----> B
7 3 C =IF(B2="",C1,B2)-----> C
8 3 =IF(B2="",C1,B2)-----> C
Please do not fix Any Cell.
Please connect if still need clarity
Regards

Here's the formula you are looking for:
=IF(A2=A1,"",SUBSTITUTE(ADDRESS(1,A2,4),"1",""))
Here's my result:

I corrected KOBY DOUEK's formula:
=IF(A2=A1,B1,SUBSTITUTE(ADDRESS(1,A2,4),"1",""))

Related

Excel Arrange multiple Columns

I have a data like this in excel:
1 1
1 2
2 2
3 2
And I want the result to be displayed like this:
1
1
1
2
2
2
2
3
Its like a ascending sorting. If the number in columnA <= columnB, it will be display first, at the same time, columnB will have a empty cell or blank value.
I have looked for this for a while but no one has the problem like this.
I would prefer a formula rather than VBA code.
Please advise, thanks!
Edit: I hope this explanation will be easier to understand
Data (A1:B2) - Result (C1:D4). Each number in Data (A1:B2) is a result of complicated formula so I cannot change its position
A B C D
1 1 2 1
2 3 4 2
3 3
4 4
Honestly, if you want to avoid VBA, here's a manual process that would give you the results you want:
Color each column (ie. Column A Red and Column B Blue)
Place values of column B under column A
Sort & Filter by Sort Smallest to Largest
Copy the contents of column A to column B
Last for Column A Find and Replace all* with format Blue then do the same for column B only with format Red. (See below for more info on how to do that).
Following those steps isn't the most conventional, but it will give you the results you wanted without VBA.
*Find and Replace based on font color:
1. Press Ctrl-H
2. Click Options
3. Click Format > Font > then select your font color > OK
4. With the Find What blank with the font color and the Replace With blank click Replace All.

Generate Column of raw data based on frequency table in Excel

I have a column of numbers and a second column of numbers. The second column of numbers contains the frequency of the numbers in the left column.
I want to create a third column of numbers that has the raw data.
Example:
A B
1 5
3 2
4 4
Column C would look like:
C
1
1
1
1
1
3
3
4
4
4
4
How can I do that in Excel? Thanks!
Based on data in A1:B3, in C1, array formula**:
=IF(ROWS(A$1:A1)>SUM(B$1:B$3),"",INDEX(A$1:A$3,MATCH(TRUE,MMULT(0+(ROW(A$1:A$3)>=TRANSPOSE(ROW(A$1:A$3))),B$1:B$3)>=ROWS(A$1:A1),0)))
and copied down until you start to get blanks for the results.
Regards
**Array formulas are not entered in the same way as 'standard' formulas. Instead of pressing just ENTER, you first hold down CTRL and SHIFT, and only then press ENTER. If you've done it correctly, you'll notice Excel puts curly brackets {} around the formula (though do not attempt to manually insert these yourself).

Excel - move a whole row into the next worksheet if the text in a particular cell of the first worksheet is Y (or Yes)

I am trying to set up a formula where worksheet 1 is a list of dates, names and the final column (I) is a simple Y or N (for Yes or No).
If the answer is Y (or Yes) then I would like the entire row to be copied into the next worksheet (worksheet 2) and if the answer is N (or No) then it does not go onto the next worksheet.
Is this possible to do, and if so how can i do it by cell formula (I don't want to change the srcipt module if possible)?
Any guidance would be gratfeully recieved.
Moving is a 2-step process in Excel (i.e. cut - paste) so this can't be done with a formula.
You could look into
autofilter to display all Y-records within the base data worksheet ... you then can copy/paste them manually
advanced filters to display and even copy Y-records, but within the same worksheet
writing a VBA procedure (not a function) to do the extraction job for you, where you first would set the Y/N field in each record manually, then press a button which moves the records; you gould go as far as capturing the event of entering Y into column 3 to automatically fire the move procedure, but I wouldn't recommend it ... what if the user accidentally entered Y ...
finally you could insert on the extraction sheet an array formula to display the Y-records; example:
Sheet 1
A B C
1 Index Info Flag
2 1 A Y
3 2 B N
4 3 C N
5 4 D Y
Sheet 2
copy headers of sheet 1 into A1..A3
select B1..B3 and enter formula =IF(Sheet1!C2="Y",Sheet1!A2:C2)
press Ctrl+Shift+ENTER to save as array formula
copy B1..B3 down
not very nice though, because you will get a FALSE FALSE FALSE for every N-record
Personally I would prefer 3) ... the button solution
You can do a workaround.
Create another tab or table within the original worksheet that pulls all your rows over via a conditional. This can be done with a VLOOKUP nested within an IF statement. (IF the cell = YES, VLOOKUP the rest of the row). I apologize for not including the exact formula, but its pretty easy to find videos etc on that portion.
On your other worksheet, use PowerQuery to query the original worksheet, and append the rows from your new table.
simply put = sign where u wanna see the result than go to that entire row and drag cursor to downward press enter. that's it.
regard: that's T.J
i entry some data i.e Customer name in Sheet1;s A1 cell , and I use this name in sheet2's cell B1 using this formula =Sheet1!B1 , now I want to move(transfer as CUT ) data from sheet2;B1 to sheet3's "C1" cel , from which formula it can be possible , ples tell
It's not the prettiest solution but it does work and I use it at my job on a workbook for logging checks received. It carries over the row if the check is postdated so that the row appears at the top of the next sheet. And it's an array formula so all the data is contiguous.
Let's use MikeD's data example above and expand upon it:
A B C D E
1 Index Info Flag Index 2 Info 2
2 1 A Y =If(C2="Y",A2,"") =If(C2="Y",B2,"")
3 2 B N =If(C3="Y",A3,"") =If(C3="Y",B3,"")
4 3 C N =If(C4="Y",A4,"") =If(C4="Y",B4,"")
5 4 D Y =If(C5="Y",A5,"") =If(C5="Y",B5,"")
Basically you are adding columns to the right of your data which checks to see if Column C equals "Y" and copies the row one cell at a time. So what we end up with is:
A B C D E
1 Index Info Flag Index 2 Info 2
2 1 A Y 1 A
3 2 B N
4 3 C N
5 4 D Y 4 D
Then on Sheet2 in cell A1 enter the following Array Formula (don't forget to use Ctrl+Shift+Enter):
=IFERROR(INDEX(Sheet1!$D$1:$D$5,SMALL(IF(Sheet1!$D$1:$D$5<>"",ROW(Sheet1!$D$1:$D$5)),ROW(1:1))),"")
Then in cell B1 you would enter a similar Array Formula:
=IFERROR(INDEX(Sheet1!$E$1:$E$5,SMALL(IF(Sheet1!$E$1:$E$5<>"",ROW(Sheet1!$E$1:$E$5)),ROW(1:1))),"")
Then you can highlight A1:B1 and drag the formulas down to A1:B5 and you should see this:
Index 2 Info 2
1 A
4 D
Then you can go back to Sheet1 and hide those nasty looking formula columns :).

Microsoft Excel 2010: Help making a Formula to up Values by a repeating pattern

I have a Spreadsheet, and inside this sheet contains a column with numbers, I want to make a formula that will go down that Column and do basically this.. Values: 1 will be 9.50. 2 will be 9.75. 3 will be 10.00. Ect going up to Value of 100? Is that possible for a Formula? I keep playing with it but can't really seem to get it down. Any help would be appreciated.
Column A: 1
1
1
1
1
2
2
2
2
2
2
2
2
2
3
3
3
3
There is not a set amount to how many values are in there.
this should do it supposing that column A has these values 1, 2 ...etc that your computing will be based on
=MIN(9.25+A1*0.25;100)*COUNT(A1)
In A2, enter the formula
=A1 + (9.5-A1)
then in the cell just below it (A3), enter
=A2+0.25
Assuming A1 is the top left. Copy the formula in A3, select the next 399 cells and paste. Then select A2 - A364 and copy. Then select B2 -xx364 and paste. xx is the last column with data. If you want, set the height of your first column to 0 to hide it.
=(A1-1)*0.25+9.5 where A1 contains any number you want

How to auto format a table in Excel?

I have a table in Excel. In each row, I want to highlight the columns that correspond to the maximum value in that row.
For example, if I have this table:
0 1 2 3
4 5 3 5
8 9 3 4
I want to highlight 3 in row 1, 5 in row 2 and 9 in row 3.
How can I do that automatically?
THANKS!
In Excel 2008, you can use Conditional Formatting in the Styles section of the Home Tab. Choose "Highlight Cells Rule", then "More Rules...". That opens the "New Formating Rule" dialog. Choose "Format only top or bottom ranked values". Then choose Format values that rank in the "Top" 1 and leave the % of selected range box UNchecked. Then click the Format button to pick the format that you want.
If you want to be able to do this fully automatically, what you can do is record a macro that does the actions described above and use that to repeat for all rows of your table.
I think you could do this with conditional formatting, and you wouldn't require code. Just create a formula that looks to see if the cell value is equal to MAX(range_name) and highlight the cell in whatever way you choose.
This is somewhat roundabout, but works for me. Add an extra column (E) somewhere, so you end up with this for data:
A B C D E
1 0 1 2 3 =MAXA(A1:D1)
2 4 5 3 5 =MAXA(A2:D2)
3 8 9 3 4 =MAXA(A3:D3)
Then in a cell, add a conditional format:
For A1: =IF(A1 = $E$1, 1, 0)
Use the format painter to copy this to the other cells in the row. Then copy to the column, modify each column so the $E$1 reference is corrected, and copy to those rose as well
Ugly, but gets the job done. Probably a quicker way to do it with VBA.

Resources