Append row1 data to row 2 - excel

I need to append data of the alternate row like D1+D2 into Excel.
Please tell me how can I do that?
I have for example:
D1 = medical
D2 = Equipment
and I need:
D1 = medical Equipment

You can't put a formula in D1 while also retaining D1 as the source of the text for that formula. You mention alternate rows, so presumably you want D3 with D4 etc. Hence I'd suggest:
=D1&" "&D2 in Row1 of some other unused column,
then copy that down as far as required,
copy that other column and paste special / values over the top of ColumnD,
tidy up by deleting the 'spare' column,
and delete contents of cells in ColumnD of even row number.
& strings together the text (concatenates) but to insert a space as well you must separate it with double inverted commas at each end.

Insert a new column D. (moving old columns to the right)
Enter this formula in D1:
=E1 & " " & F1
If you are trying to combine the data from the two columns, the & symbol will let you do that. However, the formula can't be in either of the two columns you are trying to combine which is why I reccomended inserting a column.
If you, for some reason, can't insert this formula into a column and must work only inside of the original two columns let us know and we can post VBA code that can assist. However, it sounds like the formula approach will be the simplest solution.

Related

How can I get Excel to generate columns dynamically, according to the values in a different column?

In Excel 2016, I have a "Brands" column, each of its rows containing a string. The set of possible string values is limited, and they may appear more than once.
There is related data in another column, "Models". Each model value is always different.
How can I get Excel to generate a column for each existing brand and populate it with the corresponding Models in an automatic way?
My problem is that I can't do it manually because for each analysis, the amount of Brands is different and I don't know it beforehand.
This would be the input:
And this is the expected output:
Any ideas?
Thank you in advance!
Try using an array formula. First, put the distinct brand values on row 1, starting in column D. You can use column C if you want, but I like to have an empty column between the data and the desired results.
D1 = Apple, E1 = Nokia, F1 = Samsung, G1 = Xiaomi
Then, just below Apple in cell D2, paste this formula:
=IFERROR(INDEX($B$2:$B$9999, SMALL(IF(D$1=$A$2:$A$9999, ROW($A$2:$A$9999)-ROW($A$2)+1), ROW(1:1))),"")
If you have more than 9999 rows, then adjust as needed in the formula.
With the cursor still in the formula, make it an array by simultaneously pressing CTRL-SHIFT-ENTER.
Copy the formula across to cells E2, F2 and G2. You may need to repeat the array trick (CTRL-SHIFT-ENTER) for each of those again if things look wrong. So, your excel will look like this:
Now, drag the formulas down as far as you need. The iferror part of the formula will ensure that cells look clean if no more models are found.
---EDIT AFTER RECENT COMMENT---
I cannot determine how to automatically pick distinct values from column A and automatically convert them to a row. It's easy to keep it in a column, but the transpose to row is troubling.
At any rate, here's the ugly update. Cell D1 would simply state "Brands". In cell D2, make this an array formula (CTRL-SHIFT-ENTER).
=IFERROR(INDEX($A$2:$A$9, MATCH(0, COUNTIF($D$1:D1, $A$2:$A$9), 0)), "")
So, row 2 will be your brands. Drag the formula across, repeat the array trick.
Now, in cell E1, type formula =D2. Drag across.
Place the formula suggestion from the original answer, starting in row 3. End result looks like this below. It should be "automated" now, but it's not appealing. Minor edits will help (making row 1 nearly invisible, for example).

excel SUMIFS only on same date

I'm trying to create a formula in column K which sums all cells that apply , in column J, only when the following conditions are true:
dates are the same in column A
AND client name is the same in column B
For example, in cell K2, I want the sum of J2+J3+J4 because A2=A3=A4 and B2=B3=B4.
K5=J5 only, because there are no other dates with the same client name.
K6=J6+J7 because A6=A7 and B6=B7.
What kind of formula would I use for this? I can't figure out how to do it with a SUMIFS.
I would try using a pivot table with:
The names as row values
The dates as the column values
And funds received using SUM in the values column
Edit
Based on #pnuts comments here is how to get the values in column K. Put this in K2 and drag down.
=IF(OR(COUNTIFS($B$1:B3, B3) = 1, B3 = ""), SUMIFS($J$2:J2, $A$2:A2, A2, $B$2:B2, B2), "")
This formula will give blank values until the formula finds a new client on a new date. However, I still think using pivot table is a better solution.
However, I still find the pivot table
In cell K2 put following formula:
=IF(COUNTIFS($A$2:A2,A2,$B$2:B2,B2)=1,SUMIFS($J$2:$J$10,$A$2:$A$10,A2,$B$2:$B$10,B2),"")
Adjust row 10 value. It will be last row of your actual data.
Copy down as much you need.
EDIT
Uploaded file shows the cause behind formula not working correctly for you. It turned out to be whitespace characters in column B (names) data e.g.
Cell B3: "Moe John" has a trailing space.
Cell B10: Same case with "Doe Jane"
If you want to use above posted formula then all names shall be corrected. Or alternatively to deal with spaces you can adopt below approach.
=IF(COUNTIFS($A$2:A2,A2,$B$2:B2,"*"&TRIM(B2)&"*")=1,SUMIFS($J$2:$J$28,$A$2:$A$28,A2,$B$2:$B$28,B2),"")
Notice the change in COUNTIFS formula where B2 is now replaced with "*"&TRIM(B2)&"*".
Even such formula will take a beating if you have uneven whitespace characters in between your data. I'd suggest normalizing it as much as possible.

Fill spreadsheet table with list of names

I need to fill an empty table (from an excel spreadsheet) with a list of values from a list of 13 values (names I have written in a different sheet) always in the same order. For example
Spreadsheet
Is there any way to do it without using a Macro? If there is no other way, then a Macro would be OK. I tried many things for weeks and I cannot figure it out :(
Thank you very much!
You can use this formula in the range C2:G9:
=Index( Sheet2!$A:$A ,Mod(Row()*5+Column()-13,CountA( Sheet2!$A:$A ))+1)
just replace Sheet2!$A:$A with the column or range where the names are.
( -13 is short for -ROW(C2)*5+COLUMN(C2) where C2 is the first cell where the names will be )
Okay, so it's a bit convoluted but I'll pull it into parts for now:
Add a new sheet:
in Column A put the list of names, make sure that cell A1 has heading of NAMES
in B2 put:
=Counta(A:A)
In cell C2 put 2
In Cell D2 put =IF(C2+1>$B$2,1,C2+1) - fill this across to G2
In Cell C3 put =IF(G2+1>$B$2,1,G2+1)
Then Fill this down as far as needed.
Then in Cell I2 put =HLOOKUP($A$1,$A:$A,C2,FALSE)
You can see here why we need the "header" row in A1
Fill this down as far as needed.
Example of how it looks with outputs:
Example where you can see the formula:
Now you can replace names, Add new names to the List of names etc, and it will keep the order and pattern.
I thought about putting all the formula into one cell, but for clarity have left them separate.

Merge two Excel tables Based on matching data in Columns

I've been working on a excel problem, that I need to find an answer for I'll explain it below.
I've Table01 with the Columns :
Group No
Name
Price
I've Table02 with the columns:
Group No
City
Code
I've merged two tables of Table01 & Table02 as shown in the Image03 , But without order.
But,as you see Group No Column is similar in both tables.
What I need is to get the matching rows of Table01 & 02 considering 'Group No' Column.
The Final result is to be seen as the final image.
Is there a way to do this with excel functions ?
Thank You!
Put the table in the second image on Sheet2, columns D to F.
In Sheet1, cell D2 use the formula
=iferror(vlookup($A2,Sheet2!$D$1:$F$100,column(A1),false),"")
copy across and down.
Edit: here is a picture. The data is in two sheets. On Sheet1, enter the formula into cell D2. Then copy the formula across to F2 and then down as many rows as you need.
Teylyn's answer worked great for me, but I had to modify it a bit to get proper results. I want to provide an extended explanation for whoever would need it.
My setup was as follows:
Sheet1: full data of 2014
Sheet2: updated rows for 2015 in A1:D50,
sorted by first column
Sheet3: merged rows
My data does not have a header row
I put the following formula in cell A1 of Sheet3:
=iferror(vlookup(Sheet1!A$1;Sheet2!$A$1:$D$50;column(A1);false);Sheet1!A1)
Read this as follows: Take the value of the first column in Sheet1 (old data). Look up in Sheet2 (updated rows). If present, output the value from the indicated column in Sheet2. On error, output the value for the current column of Sheet1.
Notes:
In my version of the formula, ";" is used as parameter separator instead of ",". That is because I am located in Europe and we use the "," as decimal separator. Change ";" back to "," if you live in a country where "." is the decimal separator.
A$1: means always take column 1 when copying the formula to a cell in a different column. $A$1 means: always take the exact cell A1, even when copying the formula to a different row or column.
After pasting the formula in A1, I extended the range to columns B, C, etc., until the full width of my table was reached. Because of the $-signs used, this gives the following formula's in cells B1, C1, etc.:
=IFERROR(VLOOKUP('Sheet1'!$A1;'Sheet2'!$A$1:$D$50;COLUMN(B1);FALSE);'Sheet1'!B1)
=IFERROR(VLOOKUP('Sheet1'!$A1;'Sheet2'!$A$1:$D$50;COLUMN(C1);FALSE);'Sheet1'!C1)
and so forth. Note that the lookup is still done in the first column. This is because VLOOKUP needs the lookup data to be sorted on the column where the lookup is done. The output column is however the column where the formula is pasted.
Next, select a rectangle in Sheet 3 starting at A1 and having the size of the data in Sheet1 (same number of rows and columns). Press Ctrl-D to copy the formulas of the first row to all selected cells.
Cells A2, A3, etc. will get these formulas:
=IFERROR(VLOOKUP('Sheet1'!$A2;'Sheet2'!$A$1:$D$50;COLUMN(A2);FALSE);'Sheet1'!A2)
=IFERROR(VLOOKUP('Sheet1'!$A3;'Sheet2'!$A$1:$D$50;COLUMN(A3);FALSE);'Sheet1'!A3)
Because of the use of $-signs, the lookup area is constant, but input data is used from the current row.

Convert Excel Columns into Rows

Please take a look at the attached snapshot.
How to convert the Original Table to the Required Table, in the easiest manner ?
Here, I have shared just a small sample, the real table is quite big having more then 100 rows / symbols and 100 columns / dates.
Therefor it is not possible to manually copy paste the data to change the table format.
The final output table will have just 3 columns "symbol, date and value" arranged according to the dates in ascending order.
Please suggest how to do this. Thanks
here it is.
Put Original table in one sheet, say Sheet1. Top left cell being A1 = Symbol
Go to another sheet, say Sheet2.
In cell A1 put: Symbol
In cell B1 put: Date
in cell C1 put: Value
Go to cell A2 and put this formula:
=INDIRECT("Sheet1!A" & 2+MOD(ROW()-2; X);TRUE)
Go to cell B2 and put this formula:
=INDIRECT("Sheet1!R1C" & 2+ROUNDDOWN((ROW()-2)/X;0);FALSE)
Go to cell C2 and put this formula:
=INDIRECT("Sheet1!R" &2+MOD(ROW()-2; X)&"C" & 2+ROUNDDOWN((ROW()-2)/X;0);FALSE)
In all formulas above, replace X with the number of Symbols you got. In your original table there are 4.
Now fill down as needed
Note: If functions don't work, use comma(,) instead of semicolon(;).

Resources