I thought that a nested if is what I needed, but now I don't know what I need I have explained in greater detail within my sample that's attached. Quote:....

I don't know how to write a function for what I need. Right now I have a function that says '= if $b7=0,0,if($d7>$d5,-1,1)), but I've found a problem. If there's more than one zero it throws off what I'm doing. I need a function that will ignore any zeros within column D and use the second to last number. For example:

The formula in E12 should read '=if($B12=0,0,if($D12>$D8,-1,1))
The formula in E13 should read '=if($b13=0,0,if($D13>$D9,-1,1))
The formula in E20 should read '=if($b20=0,0 ,if($d20>$d12,-1,1))

I just don't know how to write this so that it will go back to the second to last number other than zero.

What I am trying to do is create a list of unique values under certain conditions. I will try to explain it as best as I can.Imagine we have four columns:

Column A contains a product, so for example Apples, Bananas, Oranges... Column B contains names, so for example Peter, Carl, Linda... Column C contains stores, so for example Supermarket, Cornershop, ... Column D contains a number, so for example 1, 2, 3...

Now let's say I want to see who bought apples in the supermarket, I would like to query kind of like this:

For all rows where column a = "Apples" and column c = "Supermarket", write me Column b value and expect something like

Peter Linda

if only these two bought apples in the supermarket.

But I need to make sure its only unique people, so if Peter bought apples at the supermarket twice, I do not want to see

Peter Linda Peter

Now the next step would be to see what was the maximum amount of apples that peter has ever bought at the supermarket, so Im thinking of something like:

For all rows where column a = "Apples" and column b = "Peter" and column c = "Supermarket", find me the maximum value that is ever displayed in Column D.

Like I said, I'm totally new to VBA so I am not really sure how to get started with this, but what I do know is that doing this with if statements would take me forever, so I want to give vba a try.

I just need it to be able to test two seperate conditions on two seperate columns but i cant work out how its done

for example, i have two columns on a sheet, one called type and one area, both are text, i need to count how many items of one type are in a particular area. so if i have two columns "area" and "type" i want a total count of how many rows contain area="north" and type="b"

The output should check two conditions. If all three columns are "Y" then it should return value "Y". If any two columns are "Y" then it should return value "Y". or else it should return "N". Then the output should look like this.... The output column is colored in Red..........

Is what I've come up with so far. However, this returns 0, even though there are 3 items which should resolve the criteria. The main problem is here: IF((AND(APR09!$G$2:$G$500<>Department!$N$29,APR09!$G$2:$G$500<>Department!$N$30))

Where I am trying to make the sum increase by 1 if the cell from the row in question, having made it through the first 3 IF statements is not equal to either of those two cells (a range would be better) then the Sum needs to be increased by 1.

I'm trying to have a macro write down an array formula, but when I hit ctrl+shift+enter, the recorder says it can't record. If I write in the macro ...FormulaR1C1 = {=...} then I get the formula as a text. Is there a way to tell the macro that a formula should be entered as an array formula?

I basicaly need to look down column Q8 to Q52 for the falue "C19" If that value is present - Then I need to look up the value of associated with what is in its respective cell in column O8 to O52. Then add them all together.

I have the formula that follows and it works, however it is huge. I have to repeat the IF,Vlookup 44 times. Just wondering if there is a better way.

Here is the formula I am using.

=SUM((IF(Q8="C19",(VLOOKUP(O8,clusterequipmentvalues,2,FALSE)),0)), (IF(Q9="C19",(VLOOKUP(O9,clusterequipmentvalues,2,FALSE)),0)), (IF(Q10="C19",(VLOOKUP(O10,clusterequipmentvalues,2,FALSE)),0)), (IF(Q11="C19",(VLOOKUP(O11,clusterequipmentvalues,2,FALSE)),0)), (IF(Q12="C19",(VLOOKUP(O12,clusterequipmentvalues,2,FALSE)),0)), .... all the way to C52.

need to write this forwula for excel 1000((value from cell)+.256)=(((x+.314)1000)+9)1.0625. I would like to plug in a value from a cell and find the comparative value x. I am comparing the airfregiht cost between two carriers that have different surcharges for fuel, secuirty, and tax. One has no security or tax.

I am trying to write a formula using IF, OR & AND combined together, but I can't see to get my formula in the correct order. I have tried moving several sections around but I still keep getting an error.

I'm looking to write a nested IF formula which will be dependant on certain cells that have errors in them (because those error cells have a formula in them which can't formulate becuase the numbers needed for that formula haven't been entered yet).

For example.

Cell A1=#DIV/0!. Cell B1=5.

In cell C1 I want to calculate the average between A1 & B1, but there is an error in A1.

I'm trying to figure out how to make a formula which ignores an error and gives me the value in the cell which doesn't have an error. But I also need it to calculate the average if both cells have a value in it.

I have a sum field in excel which contains the formula to compute sum of certain cells. For eg. Cell C1 has value (C2+C4).

I have written a vba code to find cells whose value are to be included in the sum field (variables Lrow1,Lrow2 and Lcolumn1,Lcolumn2 contains the row and column number respectively). These cells may differ each time vba code runs. Can I write formula in the sum field based on Lrow and Lcolumn variables.

I have got mentioned below result after running a macro and I want mentioned below formula to be put after counting rows, because each time as per my query when I run macro result is different in rows as you can see in below table the formula I put in column F in rows 19, 20, 21, and 22.

two formulas to search a range containing a unique 9 digit number which contain duplicates and then see if there are one of four values in another column.

Column A contains a unique SBI number(9 digits) and will be duplicated. In column E there are a possiblility of 4 other values which are read off a list. These are "Open", "In Progress", "On Hold" and "Closed.

SBI's Open

Need this formula to everytime it finds a unique SBI it goes to column E and count if any of the duplicate SBI's have Open", "In Progress", "On Hold" task and count it as an SBI which is still OPEN.

SBI's Closed

Need this formula to everytime it finds a SBI it goes to column E and count if any of the duplicate SBI's have only "Closed" tasks and count that.

There are duplicate SBI's because there are "Tasks which are listed under multiple SBI, so an SBI number can have 1 to ? tasks under it.

Want to basically count that all tasks under that SBI are closed if they are count it if not it's still open.

Have a formula to count the individual SBI already so maybe a only have the SBI closed formula and minus that count against the total SBI's to give the not closed SBI's ?

I have a spreadsheet. In this sheet the data is added daily so one column is increased everyday. The rows may also be increased. What I am trying to do is to sum the data in each row for a range of first cell in the row to the last non empty cell in that row and this has to be done for all the rows. So I thought the for loop would be useful for such requirement and I tried to write the following code. But unable to write the sum formula in the last empty cell in a row and I get the value error. The code is as follows.....

Sub sum_on_LastEmptyCell() 'find the last empty row in column A lrow = ThisWorkbook.Sheets("sheet1").Cells(Rows.Count, 1).End(xlUp).Row + 1 'find the last empty column in a row

[Code] ........

Though one of my friend told that it can be done with "with and end with block but I am not aware of with and end with block.

It would be better if you tell me that how can I put the sum formula in my code. How can I use variables which return the row number and the column number in the sum range within the For loop because I want to put If Else condition for the calculations within the For loop i.e. if certain condition is true then I want this calculation to take place otherwise do something else. Moreover it will be easier for me to understand. Because I can use different formula based on different cells as well. Is there any way to do this?

I need to create a list of results based on a system entered on by a user with data already there. The first number they enter is the UCN (a number) then either indicate if it is a rail road or not. The values for this is Y or N. I need to have it where if they put Y then a certain formula is calculated and if they Indicate N then I have another formula calculated the results are put into the APN column. I also need to have it where I don't get an error if I have either of the cells (UNC or Railroad) ...

I uploaded a sample file of what I have so far : Book2.xlsx

I've got a "Date" Column which has every day of every month, and next to that several columns with different types of data to correspond to a particular date.

To simplify this (because there are TONS of dates), I've made another "Date" column that displays only every 5th day. Now what I'd like to do of course is average the corresponding data over five days.

I don't know how to write a single formula that I can copy down that will do this.

I've attached a sample spreadsheet with only one month's data, the stuff I need a formula / code for is in red

I have a rather large formula that I put together and it's shown in column 'C' in the small sample file I have attached. I'd like to add one more criteria such that I avoid duplicate solutions in column 'C'. i.e. I only want the first occurrence of a group.

The formula works fine 'bucketing' the first entry. If I have an solution in C I want the formula to not give me another answer if the cell immediately above has an answer. In other words, rows 11 and 15 would be blank because rows 10 and 14 have an answer.

I've tried inserting another criteria in the AND statement, like ISBLANK for the cell above, but I can't get it to work. What am I doing wrong, OR is there a simpler solution?

=IF(C2="Windows",B2,IF((AND(A2=A3,C3="Windows")),B3,IF((AND(A3=A4,C4="Windows")),B4,IF((AND(A4=A5,C5="Windows")),B5,IF((AND(A5=A6,C6="Windows")),B6,IF((AND(A6=A7,C7="Windows")),B7,IF((AND(A7=A8,C8="Windows")),B8,"None")))))))Here is a link to the spreadsheet (D2 being the formula cell):

Basically, I am trying to put the columns data (if it has a porch, conservatory, windows) into one row for the contract number, as the dump which I have, is giving me seperate row's instead of one.

I am trying to get the formula to check if the contract number matches on the following row, and if it does, to check if the Product Description matches the header of that row (if it's a window, conservatory) if so, copy the quantity cell into D1, however, it's copying it even if the contract numbers do not match and I do not know where I am going wrong!!

I would like to use the following line to calculate the formula, In the format i have already specified.

But to leave the values in the cells apposed to the formula.

This way when i delete the source sheets the results will still be left as values not formulas.

It can probably be done in 3 lines but i have to do this for 9 different rows so was wondering if there is a way of combining the three tasks into one row