Copy and paste columns to another sheet based on a criteria - excel

How do I copy and paste columns from Sheet 1 to Sheet 2 which has the word "To" in its column headers?
Example, Column H Header = 12/2/2014 To 14/2/2014
I want to copy only these types of columns and paste it on another sheet.
P.S. I'm looking for a non-vba solution (if there is one) so any help would be much appreciated.
I've tried using this formula but nothing happens.
=IF(COUNTIF(Sheet1!A$1,"*TO*"),Sheet1!A2,"")
P.S. I'm using Excel 2013.

You can use Find formula that will return the number of "To" for that.
=IFERROR(FIND("To", A1, 1), "Did not found")
And in VBA you can use InStr that does almost the same operation.

Related

How to only run a formula if the cell is blank

I am writing a formula to run a matching analysis on some elements of a spreadsheet. The column containing the formula already has values filled in, but I need to run the formula on the blank cells. The formula is working but overwriting the current info I have within the filled cells.
I have tried a VBA code which got too complicated and did not work. With VBA I tried inserting the formula into only the blank spaces but was having some issues. I have also tried a basic excel formula.
=IF(COUNTIFS(A:A,A2,BU:BU,"CLOUD")=0,"Not Cloud",IF(COUNTIFS(A:A,A2,BU:BU,"NOT CLOUD")=0,"Cloud","Hybrid"))
VBA Code I tried:
If (IsEmpty(Bucket) Or Bucket = "" Or Bucket = vbNullString) And _
(GetCellValue(.Cells(i, "BU")) = "CLOUD") Then
Range("CC:CC").Formula = "=IF(COUNTIFS(A:A,A2,BU:BU,""CLOUD"")=0,"Not Cloud", _
IF(COUNTIFS(A:A,A2,BU:BU,"NOT CLOUD")=0,"Cloud"","Hybrid"))"
A reminder this is a high-level version
I want that formula to only run in the cells that do not have a value already in place. It should not overwrite the data from the VBA script that I previously ran before doing the formula. The disposition column should be completely full of values. The formula needs to run in only the blank cells.
You could achieve this with an additional column.
In the column to the right of Disposition (insert one if necessary) write the following formula (example for row 2, assuming Disposition is Column C):
=IF(C2=""; [Your formula here]; C2)
This will provide you with a column full of values, anytime you put a value into column C it will override the formula.
Edit: You can then copy this formula down the entire column to achieve the desired effect.

Vlookup - how to deal with #n/a errors - office 365

I'm using MS Excel O365 Business in version 1905 (compilation 11629.20196). In this case i have created two sheets: 1) "Orders"
2) Order_status
NUMBER_ORDER Column (in Order_status sheet) has been created all cells by drop down list giving source to column in "Orders" sheet: =Orders!$B$2:$B$1048576
Now i'd like to create a formula in DESC_ORDER from "Order_status" sheet which automatically writes data from cell in "NUMBER_ORDER" Column. By writing that formula i have "#N/A" Error (despite the correction all data in the 2 sheets).
What I've tried?
I tried in a few different ways:
1) I've written =VLOOKUP(E2,Orders!$A:$B,COLUMN(Orders!$A$2:$A$1048576)) then i formated text to column the DESC_ORDER in "Orders" sheet. It didn't work.
2) Then i tried this VLOOKUP by changing to text in E2 cell: =VLOOKUP(TEXT(E2,"#"),Orders!$A:$B,COLUMN(Orders!$A$2:$A$1048576)). Didn't work too.
3) Then i modified to Trim in E2 cell: =VLOOKUP(TRIM(E2),Orders!$A:$B,COLUMN(Orders!$A$2:$A$1048576)) Didn't help.
4) Later i created 2 views "Orders" for these 2 columns for in "Orders" sheet. And "Orders_status" in columns from "Order_status" sheet. The i rewrote that formula: =VLOOKUP(Order_status,Orders!$A:$B,1,FALSE) and still shows #N/A! Error.
I've been looking for any solution but i haven't still found. Can someone please what should i do? Any ideas? Thx in advance for help or any tips.
Try:
=INDEX(Orders!$A$2:$A$6,MATCH(E2,Orders!$B$2:$B$6,0))
Results:

Excel: Adding a row disrupts formula

In a spreadsheet I use for cash management tracking, I have the following formula:
=IF(D176="Cash", F175+C176, IF(D176="Transfer", F175+C176, F175))
When I add a row, I use control+D to fill in the formula from the cell above (I'm using Excel for Mac 2011). This results in the correct formula as follows:
=IF(D177="Cash", F176+C177, IF(D177="Transfer", F176+C177, F176))
However, this has the effect of changing the formula in the cell in the row below:
=IF(D178="Cash", F176+C178, IF(D178="Transfer", F176+C178, F176))
Here you can see the rows for column F are not correct: F176 should be F177.
Can anyone offer any advice to ensure that when I insert a row the formula remains intact?
Thanks.
Replace all of the references to F175 in the original formula (the one if row 176) with INDEX(F:F, ROW()-1).
=IF(D176="Cash", INDEX(F:F, ROW()-1)+C176, IF(D176="Transfer", INDEX(F:F, ROW()-1)+C176, INDEX(F:F, ROW()-1)))
'or better as
=INDEX(F:F, ROW()-1)+(OR(D176={"Cash", "Transfer"}*C176)

Simple VB ststment deconstruction

Could somebody please explain this simple vba statment to me? I just want to know what each part is referring to, and basically what this statement is accomplishing within my workbook. Thank you
ActiveCell.FormulaR1C1 = "='Bren Template'!R[-3]C[-6]"
This is a cell reference. In the ActiveCell (the one chosen), it will put the formula ='Bren Template'!R[-3]C[-6]. The formula breakdown is "Bren Template" is a reference to a sheet with that name. The R[-3] refers to three rows ABOVE the active cell. The c[-6] refers to three columns to the LEFT of the active cell.
So, if the active cell is H5 that formula will read ='Bren Template'!B2
If your active cell is I6, then the formula will read ='Bren Template'!C3
Note: The r[-3] and c[-6] will be "translated" from R1C1 style (i.e. Row 1 Column 1) when the formula is actually set in the cell.

excel sheet sub headings as columns

I am totally new to this kind of challenges and not sure any thing available ( not sure even on what base I have to search )
In the below excel sheet image the column 'A' has headings in two places ( row numbers 2,3 and 9,10) . The actual excel sheet has more than six thousand rows and too many sub headings like this ( If it is small file I can do it manually.. but more than 6 thousand rows)
The challenge :- I want to populate E column with "Make" value and F column with " Model" from sub headings . Can I write any rule or macro to populate these columns ? could some one help me ? Thanks for your help
Image Link
or below
Regards
Kiran
If you want to do this solely in Excel you can use the following. This assumes
All Headings are the same for "S.No"
Change the SUBSTITUTE clause to match the text for Make and Model eg I have used exact spacing of "Model: " and "Make : " to match the spreadsheet and substitute with ""
In cell G5 Enter =IF(ISNUMBER(A5),IF(ISERROR(FIND("Model",A3,1)),MAX($G$1:G4),MAX($G$1:G4)+1),"")
In cell F5 Enter =SUBSTITUTE(IF(ISNUMBER(A5),INDIRECT(ADDRESS(MATCH($G5,$G:$G,0)-2,COLUMN(A1),1)),""),"Model: ","")
In cell E5 Enter = =SUBSTITUTE(IF(ISNUMBER(A5),INDIRECT(ADDRESS(MATCH($G5,$G:$G,0)-3,COLUMN(A1),1)),""),"Make : ","")
Then drag down the formula in E5:G5 to wherever you need. However, I only recommend using this once only as the formulae will be slow to update over large ranges. Also if your headings are out of sync then VBA is the way forward

Resources