i want to put all column for 1 row into row in xls [duplicate] - excel

This question already has answers here:
How to "flatten" or "collapse" a 2D Excel table into 1D?
(9 answers)
Closed 9 months ago.
i want to put all column for 1 row into row in xls
input:
Output:

Not the cleanest way but it does the job.
Formula in column I:
=INDEX($A$1:$A$4;ROUNDUP(ROW()/5;0))
Notice the division between row number and 5. The divisor is 5 because you got 5 elements to get (c1,c2,c3,c4,c5). Change 5 to whatever columns you need to fecht.
Also, please notice you need to drag manually until you get the quantity of elements. In this case, your data is a table of 4x5 = 20 so you need to manually drag the formula from row 1 to row 20
Formula in column J:
=INDEX($B$1:$F$4;MATCH(I1;$A$1:$A$4;0);COUNTIF($I$1:I1;I1))

Select your data
Data -> from Table/Range (unselect "My Data has headers")
(=> Power Query Editor is started)
Select Column 2 to Column 6 in Power Query Editor
Transform -> Unpivot Columns
Home -> Close and Load to ... (Existing Worksheet "H1")
DONE! ;-)
Screenshot step 2:
Screenshot step 3+4:
result:

Related

Vlookup does not return the result on the index number [duplicate]

This question already has an answer here:
Excel Vlookup Function
(1 answer)
Closed 10 months ago.
I am implementing the VLOOKUP in the excel
When I use the index 3 it works
when I put index 4 it does not return anything .
Both the index has some values. It should return . What could be the problem ?
This is Monthly sheet columns .. it has columns till M
You table has 3 columns A, B & C, so using 3 picks the result in column 3, but 4 won't exist as there is no column.
You gave the range in Table_Array as Monthly!A:C, so it won't know about any columns after column C as shown in both your images, only one shown here:
So do the correction and put Monthly!A:M then you can address the rest of the columns, until then it will not work.

Excel Compare values from two tables and copy data [duplicate]

This question already has answers here:
Excel Lookup function for text [duplicate]
(2 answers)
Excel formula to copy data adjacent to a cell and paste it next to a duplicate cell in another column
(2 answers)
Excel Formula for Inventory
(1 answer)
Excel - find cell with same value in another worksheet and enter the value to the left of it [duplicate]
(2 answers)
Check if an excel cell exists on another worksheet in a column - and return the contents of a different column
(1 answer)
Closed 1 year ago.
I have a small Excel task that I am stuck on.
I have two Excel tables and would like to fill table 1 with values from table 2.
Example:
Table1:
A
B
C
D
E
1
Dude
2
Table2:
A
B
C
D
E
1
Max
Muster
Way
3
53
2
Dude
Test
Street
42
44
The formula should now copy the value from Table2 B2 in Table 1 for B1.
This means that the formula must find the correct row in table 2 using the value in table 1 A1 and copy the value from column B.
Does anyone have any ideas?
An easy way would be using INDEX and MATCH:
My formula in column I is:
=INDEX($B$1:$E$2;MATCH($H1;$A$1:$A$2;0);1)
Notice last argument of INDEX is 1 for column I, 2 for column J, 3 for column K and so on. Depending on where is your data you may need to adapt this part. And for sure you can use another formula to autoselect proper column instead of typing 4 different formulas, but as I said, this would be the easiest way (not the cleanest, tough)

Removing specific rows in Excel

I have a data set in Excel as shown in the snippet below:
Patient Number Age State
1 20 1
1 20 3
1 20 2
2 35 1
2 35 4
3 62 2
3 62 1
3 62 3
3 62 4
3 62 5
I need to keep the last row of each patient, i.e. I need the dataset to look as follows:
Patient Number Age State
1 20 2
2 35 4
3 62 5
Is there a simple way to do this with Excel? Since the dataset is huge and cannot do it manually
If your data is in A:C columns, you can add another column with the following formula in D2:
=A2<>A3
Fill it down. Apply autofilter, choose False in D column and delete all filtered rows.
Edit:
This solution assumes your data is sorted by A column.
Enter below to D2 and press CTRL+SHIFT+ENTER to make it an array formula:
=MAX(IF($A$2:$A$11=A2,ROW($A$2:$A$11)))=ROW()
Advantage of this formula is PatientNumber column doesn't have to be sorted. Formula will find the last entry for each PatientNumber. See below, added one more row for Patient number 1:
You can easily keep the top entry with Data ► Data Tools ► Remove Duplicates. To keep the last entry, you first need to reverse the order.
In an unused Helper column to the right put a 1 in the top row then select all of cells in that column to the bottom of your data and use Home ► Editing ► Fill ► Series to gain a column of sequential numbers.
Sort your data using that new column in descending order.
Choose Data ► Data Tools ► Remove Duplicates using only the Patient column as the criteria for duplication.
Delete the Helper column as it is not longer needed.
Duplicates are deleted from the bottom up so the first value for each patient will be retained.

Get maximum value based on unique values

I have two columns in Excel as follows:
col1 col2
1 10
1 22
1 11
1 23
1 14
2 16
2 12
2 10
2 9
How do I write a command to returns the maximum value from col2 corresponding to each unique value in col1?
So here I need to write a command to get 23 and 16.
The data I have shown here are dummies; I have 600 unique values in col1 in my actual data set.
Pivot tables: the single most underutilized and powerful feature of excel.
File menu:
Insert
Pivot Table
Select range
Fill in as indicated in image below
Step by Step:
Place cursor in cell to right of all data on sheet.
Select insert from menu
select pivot table icon
select pivot table from pop-up of icon
use the button to select the range of cells included (all 600+ rows in 2 columns) (or just enter $A:$B)
select ok
A pivot table field list appears on the right:
Drag and drop row 1 into row labels.
drag and drop row 2 into values area.
left click on "... of Row 2"
select value field settings
select "Max" instead of count or sum
select ok and you should have desired results.
The pivot table will find the max value in row 2 for each unique value in row 1 which is what I believe you are after.
Even if a solution has been found. I think it is too complicated and oversized to use the pivot for this and it might not be possible in all scenarios. Here is one that can be found searching the internet for "max if excel" (e.g. see here; adapted)
{=MAX(IF(A:A=A1,B:B))}
Attention! This is an array formula, you have to enter it without the curly brackets and then press Ctrl+Shift+Enter to submit the formula.
Since the left hand values seem to be in order, Subtotal should work.

Format Cells from 2 sheets, based on 4 column comparison

I need to find changed values in dataSet.
So I have 2 sheets with, in general, same data.
I have two columns: docID(which is unique key) and rev(which is not unique).
I need to find(highlight/display only/...) those rows, where for same docID from first sheet rev is different in the second sheet.
UPDATE 1
Sheet 1:
docID rev
1 5
2 6
3 1
Sheet 2:
docID rev
1 6
2 6
3 1
Only the first row makes an interest to me, as others did not changed.
UPDATE 2
simple if statement which should give some understanding what I need. In general this is done on similar test data set, so cells are incorrect.
=IF(NOT(AND($B6=Sheet1!$B6;$C6=Sheet1!$C6));1;0)
So values are NOT equal.
You can do this with a custom formula in Conditional Highlighting:
Select the top cell in the column docID column, then select the whole column (in the example, I assume that this is column A and you select A1 and the rev is in column B, same structure in both sheets. Adjust as to your needs)
Goto home->Conditional Formatting->New rules->Use formula to determine which cells to format and enter the following formula:
=VLOKUP(A1,Sheet1!$A:$B,2,0)<>B1
Click on format and select the format you need.
Done!

Resources