Excel - Loop through rows and reverse order - vba

I was looking for a code that loop through all rows (I got too many), and change order for every three rows. I have a form of rows like this...
see image
Need to loop through all rows in column B and reverse order for every three rows and get this (for better analysis). Thank you
see image

If I understand your question correctly, type this formula into a cell in column B and drag down as far as necessary:
= INDEX(A:A,ROW()+2*(1-MOD(ROW()-1,3)))
VBA is not needed. This formula copies the values from column A to column B, but reverses the order of the entries every three rows as shown in your example image from your question.
See below.

Related

Find number of rows in an already filtered Column A in Excel

I have got an Excel spreadsheet. This spreadsheet has just one tab in it. The Tab name is dynamic in nature and changes every week also the number of rows.
I have column A filtered already with a VBA macro. A1 has the header.
Now, I wanna find how many rows are there in this already filtered column A.
I am looking for any VBA function.
I have tried using Subtotal function.
=Subtotal(103,A2:A1345)
But I don't know the end range. As of now the end range is A1345. It will change every time in future if the new rows are added.
I tried multiple things but those did not work. I am quite new to VBA.
If A1 will never be blank, you could use (in a column other than A)
=Subtotal(103,A:A)-1.
Or, if there will be data below your table not to be counted, then format your table as a Table and use structured references (and this formula could go into column A)
=SUBTOTAL(103,Table1[column_header])
You can put the formula in column A if you use another column's last populated cell as the demarcation point.
If column B contains numbers then,
=subtotal(103, a2:index(a:a, match(1e99, b:b)))
If column B contains text then,
=subtotal(103, a2:index(a:a, match("zzz", b:b)))

Master Spreadsheet, Referenced by presentation spreadsheet - potentially hard?

I just started a project for a client company and they're needing something kind of unrelated, I'm hoping to get some help with that here.
The situation is this. I have a continually updating "master" spreadsheet located at \ServerA\Folder1\Folder2\MasterSpreadsheet.xlsx. This houses dates ascending left to right on row 219. The dates are ascending(Format mm/dd/yyyy), but not sequential(they skip a few days here and there). The Quantity(row 220) corresponds with dates(row 219). These both start on Column C.
FIRST "Set" of dates/qty on row 219/220 Column C.
SECOND "Set" of dates/qty on row 224/225 Column C.
I then have a "Presentation" spreadsheet that will reference the master.
Dates are ascending top to bottom (range 4/25/18 - 12/31/18) in column F and ARE SEQUENTIAL, qty in column G, starting row 9.
So basically what i need is an excel statement that will do this, in whatever fashion is needed.
If the FIRST AND SECOND sets' dates in the date row in MASTER match(could be in column C, all the way to column CZ), the quantities for them both will be added and placed into the correct row (Dates match) in the PRESENTATION spreadsheet.
If the FIRST AND SECOND sets' dates in the date row in MASTER DO NOT match, then they just go to their respective dates on the PRESENTATION spreadsheet.
I hope that was clear enough! Sorry to ask, i can do the rest but this really has me stumped.
Thank you very much!!!!!
I do not understand why you differentiate match or not match for master sets date.
I suggest in sheet PRESENTATION from cell G9 :
=SUMIF(MASTER!$C$219:$CZ$219,PRESENTATION!F9,MASTER!$C$220:$CZ$220)+SUMIF(MASTER!$C$224:$CZ$224,PRESENTATION!F9,MASTER!$C$225:$CZ$225)

Adding a row between cell with the same value using VBA code

Im new in VBA and want to know how can i format my table in such a way that each name in Column one do only have 1 row in between.
Some of them do have more than 1 row in between and some of them doesn't have. I just need to format then in such a way where every name on column A has 1 blank row in between. Any help would be appreciated!
Please note that i have thousands of data so manual will not work.
also i tried doing the filtering and convert them into single block. the problem with single block is that my column c do have more than 1 information which is connected to column a, .
here is an example.enter image description here

Transpose Columns in Order using Excel VBA

I have an extremely large amount of data needs to be transposed in order using the example on the image below. The left side of the image is how the information comes from the report, and the right side is what I need it to look like.
I have tried to use the Transpose paste special but it results in 3000+ columns of information. I have also tried pivot tables but I get the information out of order.
The three pieces of "Info" are per employee. As it stands now, the lines are vertically but in our end result we should have three rows per employee.
Transpose Left Original Data Right Outcome Needed
you can achieve this by the below formula
F1 = INDEX($A$1:$A$3,1+QUOTIENT(ROW()-ROW($F$1),3))
G1 = VLOOKUP(F1,$A$1:$D$3,2+MOD(ROW()-ROW($F$1),3),FALSE)
So if you have 3000 lines of data, the formula should be dragged to 9000 rows.

Filter if one or another value is equal to cell

I need to solve one simple problem. I do have a one huge table that contains around 300000 rows with data and basically what I need is to filter out row if the cell in either G or L row is equal to cell in 'Input sheet'!C2.
Please see attached image.
So if the either G column or L column is containing value from cell then I want to copy entire row into sheet called 'Direct'. The 'Direct' will not contain empty rows.
As It is huge amount of data, that will grow a bit the code must be a bit optimized.
Many thanks in advance!!!
Cheers,
F.