excel function to vba code (exclusive quartile & if function) - excel

I am trying to get this piece of excel function into vba code (mainly because there is no such thing as "application.worksheetfunction.if" - would be great if i can get some help here!
=quartile.exc(if((F:F=F2)*(Y:Y=1),I:I),1)
basically, i wanted to find the 25th percentile of all data in column I if two criteria are met: 1) if value of column F is the same, 2) if column Y value = 1. Otherwise return to blank.
Thank you very much!

If that formula gets you the answer you want, then you could simply use:
Activesheet.Evaluate("=QUARTILE.EXC(IF((F:F=F2)*(Y:Y=1),I:I),1)")

Related

Excel VLOOKUP - function #NAME

could someone please tell me whats wrong with my =VLOOKUP(E3;E:E; 2;0) - function?
In German it is the following: =SVERWEIS(E3;E:E; 2;0)
I never used the VLOOKUP - function before so I just try to make it work somehow. Unfortunately it does not get the reference right, although I compare numbers with numbers in the same workbook. I also tried =SVERWEIS(E3;E:E; 2;1) but it didn't work either.
Thank's a lot!
Greetings!
You have the number 2 for the column where the values are located, but your range is only 1 column. If the value you want to return is in column E then the number 2 should be a 1. But if the value you want to return is in column F, then you need to change the range to include column F

Excel sum without specific rows

I need help with creating sum formula on Excel sheet.
I need on excel show sum formula without specific rows. In these rows for example is word "W" or something other way. And I need show sum for example:
=SUM(A1:A5) ........ without if column E have = "W"
I tried checkbox solution, but I finding other better solution:
Please can you help me, how can I do it?
EDIT :
i also posting you my excel sheet what i tried from your solution, but not working:
example of excel sheet
You are looking for something like =SUMPRODUCT(--(NOT(E1:E5="W")),A1:A5). Sumproduct multiplies everything in one column with everything in another, and sums the results. -- converts a boolean statement into a 1 or a 0.
So, with this formula, you would be multiplying each item in column A with either a 1 or a 0. Obviously, things multiplied by zero do not have any effect on the final sum :)
You could use SUMIF formula to only sum column A if the column E has a value of W like below:
=SUMIF(E:E,"w",A:A)

Need to do advanced Sum based on all raw data on a single row

Now I have a formula which is:
=SUMIFS(Data!S2:Data!S2000;Data!V2:Data!V2000;"BankAxept";Data!M2:Data!M2000;C4)
But I need to extend it as I need to make the calculation between two dates choosen within a VBA script; RevenueFrom.Value & RevenueTo.Value
The dates to look between is in column R (formatted "yyyy-MM-dd").
UPDATE:
The condition is:
Based on Serialnumber (column C) AND when value = "BankAxept" (column V) Then Sum Rows (column S) between date RevenueFrom.Value AND RevenueTo.Value (column R)
At the moment I have 2000 rows to check every time.
What formula is best, and how do I get the formula to work?
I actually managed to solve the formula myself :)
=SUMIFS(Data!S:S;Data!V:V;"BankAxept";Data!M:M;C4;Data!R:R;">=2015-10-25 11:50:00";Data!R:R;"<=2015-10-25 11:59:59")
I used the AutoSum->More Functions->SUMIFS funtion to build the formula; I had no clue Excel was providing me this simple way of creating the formula. Thanks for the efforts.

VBA Code to sum values in one column based on the value in another column in excel

I am a VBA Newbie and a first timer on this forum - I have followed all the instructions on the "how to ask" page - I may have missed something please do advise
I am creating an EV report for project tracking based on the following column headers (showing only a few for brevity)
"TaskName" "Status" "BaselineStart" "BaselineFinish" "BaselineEffort"
need to sum up the values in the BaselineEffort column in 7 day increments after checking if the value in the BaselineFinish column is less than or equal to the 7th day value
I believe the answer lies in using arrays, but need handholding with that concept to understand how it works
Pivot and Excel formulas dont work for me because the table is dynamic while the report is static and I need to remove user intervention in creating the report
Thanks in advance
say that the criteria column starts in A1 and the colume to be summed starts in B1
do while not isempty(range("a1").offset(x,0))
if range("a1").offset(x,0) = SomeValue then
sum = sum + range("a1").offset(x,0)
end if
x = x + 1
loop
this code will run until it has looked at each item in column A, and add the value in column B to a sum I called "sum" if the value in column A equals "SomeValue." I doubt you can actually use the variable name "sum."
I hope that's useful.

Excel Problems- Calculated value as a cell reference

I'm relatively new to excel programming. I'm working on making a spread sheet that shows exponential decay. I have one column (A1:A1000) of 1000 random numbers between 1 & 10 using the TRUNC(RAND()*10,0) in each cell. The next Column (B1:B1000) has a logic mask =IF(A1=0,1,0) , where if the value in the A cell is 0, then the B cell shows a 1. Next, to find the number of 0's in the A column, I have the next column taking the sum of B1:B1000, which returns the number of 0's that showed up in the first column. I'm sure there's an easier way to do that, but this seems to work fine.
Here's my problem, hopefully it's clear what I'm asking:
Next, I want to take the sum of the logic column (B) from B1:B(1000- the value of the sum from (B1:1000)) in the cell below the cell that calculates sum(B1:B1000). Is there a way to to algebra in a cell formula to reference a cell? More simply, if I want to refer to A3, for example, is there a way to input something like A(2+1) to get A3? Does this make sense?
You can very easily do, in VBA:
ActiveCell.Formula = "=A" & (2+1) & "+15"
In Excel:
=INDIRECT(ADDRESS(2+1, COLUMN(A1)))+15
This will set the formula to "=A3+15". Generally, this is best done with variables, so remember to do that.
In Excel, and as pointed out by Eric, you can write the referance to the cells just like normal strings thanks to INDIRECT() function.
Just make sure that the string passed to INDIRECT() is a valid cell reference.
For example :
=SUM(INDIRECT("B" & 2+7*(H2-1)):INDIRECT("B"&(2+7*H2)-1))
Here, I sum 7 lines for each week (H2). It gives the sum of B2:B8, B9:B15, B16:B22, etc.
Hope my example will help you figure out how to use it in real situation.

Resources