I have an excel in below format:
I want a formula to loop through each row and identify if there is fail in any row. So result should be something line below. I can do this in VBA but wanted to check if we can do this using excel formula.
In E1, formula copied down :
=IF(COUNTIF(A:A,D1)=COUNTIFS(A:A,D1,B:B,"Pass"),"Pass","Fail")
Edit :
In D1 copied down :
=IFERROR(SMALL(IF(FREQUENCY($A$1:$A$10,$A$1:$A$10),$A$1:$A$10),ROW(A1)),"")
Or, use "Remove Duplicates" Excel built-in function
Related
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.
I need to know an equivalent in VB code for:
'In Excel cell (for ex. xlSheet.Range("A1"))
{=Average(If(A1:A10="Text",B1:X10))} ' <---Equivalence of this written all in VB code, not in Excel
That is, calculate the average of an Excel matrix (for ex. B1 to X10 Excel range), with criteria, from VB.
Here:
Evaluate("=AVERAGE(IF(A1:A10=""test"",B1:U10))")
Don't forget to put double quotes after single quotes for text.
I would like to suggest this code for the issue:
Worksheets("Data1").Range("D2") = Application.WorksheetFunction.AverageIfs(Worksheets("Sheet1").Range("A2:A11, "E2<>0", B2:B11))
Other should be:
Suppose in A1 you have written this formula, so in VBA code you can use something like this:
=IF(WEEKDAY(A1,2)>5,"NO WEEKDAY","")
Range("b2").Formula = "=A1"
Please change cell address as you need.
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.
I have the following formula
=IF((GLOBAL_DATE-30)<G2,"1 Month",IF((GLOBAL_DATE-60)<G2,"2 Month",IF((GLOBAL_DATE-90)<G2,"3 Month","Older Than 3 Months")))
and I would like to write this into specific cells using the FormualR1C1 in VBA.
(the GLOBAL_DATE is a named cell on another sheet)
Thanks
Select the cell that has that formula. In the VBE, go to the Immediate Window and type
?Activecell.FormulaR1C1
and press enter. That will give you the R1C1 translation of your formula.
This is what I get using the Macro Recorder:
ActiveCell.FormulaR1C1 = _
"=IF((GLOBAL_DATE-30)<R[1]C[6],""1 Month"",IF((GLOBAL_DATE-60)<R[1]C[6],""2 Month"",IF((GLOBAL_DATE-90)<R[1]C[6],""3 Month"",""Older Than 3 Months"")))"
That is using relative cell addresses (R[1]C[6] is the cell one row below and 6 columns to the rigth from the ActiveCell. Alternatively, you can use absolute adresses by replacing R[1]C[6] by R2C7 (for row 2, column 7 = G2).
You can easily use VBA to translate those formulae that you entered in a sheet into a sytax that's suitable for VBA. I once wrote a sub for that purpose.
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