Append row 1 & 2 together, then row 3 & 4, and so on in excel\text file - excel

I have a spreadsheet that contains building details, but the building details are spread over 2 rows, so row 1 & 2 contain the building info for building 1, then rows 3 & 4 contain details for building 2. Is there a way to append row 2 to row 1, and then row 4 to row 3, an so on.
The source file is currently a .xlsx, but can be saved as .csv or txt if easier to work with.
Thanks in advance,

Didn't see your file attached but here is an idea:
Use the offset function to copy your even rows after your odd rows, assuming your data starts in A1 in the cell after your last cell with data in column A: +offset(A1,1,1,1,1) and copy paste for as many cells as you need.
Drag this down for all your rows.
After your last cell of the offset data in column A put a 0 and in column B put a 1. Drag this down for all your rows so you have a 0 for the rows you want and a 1 for all rows you don't want.
Filter out all your rows with 1 and delete them using Ctrl + g and click special then click visible cells only and delete all the rows defined by 1.
Hope this helps

You need use -ReadCount key at Get-Content, it specifies how many lines of content are sent through the pipeline at a time. The default value is 1. A value of 0 (zero) sends all of the content at one time.
Code:
Get-Content -Path "path to your file" -ReadCount 2 |ForEach-Object{$_ -join ""}

Related

How would I delete a row of data if none of the cells are empty?

I have a spreadsheet with sales data for a given month for a number of different stores. There are approximately 450 rows (stores) to go through. The days of the month are in row 1, starting in column B, with the store numbers in column A, starting in row 2. What I need to find are the rows that are missing data for different days. I can use conditional formatting to highlight the cells that are empty, but that is still a lot to look at. What I am trying to do is reduce the amount of cells to look at by deleting any rows that are not missing data. So if a row is not missing any days of data, then I don't need to look at it, and can delete it. But if it is missing data, then keep the row.
I'm stuck on figuring out the actual code, but I have come up with pseudo code for what I want:
foreach row in range ($B$2:$AB$450)
foreach cell in row
if cell < 1
delete row
end foreach
end foreach
Here is an example of the spreadsheet:
A B C D
1 12/1/2019 12/2/2019 12/3/2019
2 Site 1 1000 2000
3 Site 2 5000 5000 3000
4 Site 3 6000 4000 3000
In this example, rows 4 and 4 would be deleted because they are not missing any data.
Thanks
**assuming that you have 4 columns and they start in column B:
with an array formula you can see the length of characters in each row.
=MIN(LEN(B2:E2))
for example, you can use the above formula in row 2 (remember: ctrl+shift+enter to use it)
So, if you apply that formula per row, you should be able to know if you have missing value per row (all of them that have length 0 per row); then, use that column to filter. E.g. Filter anything that is not 0.

How can I use a relative range in an excel function

newbie with advance excel here. :)
I'm looking for a solution how to use dynamic or relative range with the expression I came up with. I have this excel sheet with multiple columns, but I only need to check 4 columns for info. The sheet has like 1000 rows and growing, and I need to go through each row and check for blank cells in each row. Obviously dragging the cell with my formula using the mouse automatically updates the cell reference on the expression. However, I'm going to use the expression in an automation tool where it looks one row at a time and captures the value into another "array" or "collection" variable.
Col A B C D
Student1 7 8 0
Student2 2 1 2
Student3
Student4 1 0 2
Student5
Student6 8 2 4
Student7
Student8 3 1 2
I have this excel expression
=IF(AND(A2 <> "", A3<>"", A4<>""),A1,"empty")
Expected results should be like the below and placed in another Sheet (Same workbook)
Student3
Student5
Student7
Thanks in advance!

Compare 2 sheets in 2 csv and replace value from one to the other

I'm trying to compare two sheets in excel and if matching "A" value then copy the value in the "B" to the other "I".
Ex:
Compare
Sheet 1 column A to Sheet 2 column A, if the Alpha numbers match then copy the value in Sheet 1 colum B into Sheet 2 colum I.
I have reference number in both A in need to replace the old image url by the new image url.
I have over 15 000 items and I will have to do this everyday so any automation would be great.
I have 2 csv files.
Any help would be appreciated
Thanks!
In Sheet2 column I using formular:
=IF(A1=Sheet1!A1,Sheet1!B1,"Value_if_not_match")
Hope this can help

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 :).

Finding matching value in sheet 2 and copy adjacent cells value in sheet 1

I have searched through many similar topics but could find nothing that will do what I need.
I am trying to create a worksheet that will track scores for a darts game.
On Sheet 1 I have two columns that simply tracks each players throws from 501 down to 0
Row 25 is the amount remaining for each player.
In Sheet 2 I have 2 columns. The Column A contains scores that you can check out on, and Column B contains the checkout e.g. (T20, T20, D18). So if the value in row 25 of Sheet 1 matches any of the values in Column A of sheet 2, the I want to display the Value of Column B in the matching row on Sheet 2 Underneath the remaining score on Sheet 1.
Can anyone point me in the right direction?
not sure what you mean exactly, but this formula in row 26 should do the trick:
=index('Sheet 2'!$B:$B;match(A25;'Sheet 2'!$A:$A;0))
if your list separator is comma ,, use that instead of semicolon ;
you might want to use 1 as the third argument of match function, if you want to display the checkout according to the nearest match that is bigger than the number in row 25 and the column A in Sheet 2 is sorted in ascending order (1-9)
or -1 if you want the nearest match that is smaller and column A is sorted in descending order (9-1)
You can use this:
=IFERROR(VLOOKUP(A4, Sheet2!$C$2:$E$65535, 3, FALSE),0)

Resources