# Better Way To Write A Sum IF Formula

Nov 5, 2008
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.

View 13 Replies
ADVERTISEMENT
Jun 7, 2006

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?

View 2 Replies
View Related
Jan 23, 2014

Write a formula with a cap of 125%

A

B

C

D

1

x

y

z

2

Commission

1000

1000

500

[Code] .......

How to write the formula to know how much commission with be paid out for x,y,z?

View 2 Replies
View Related
Jan 30, 2007

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.

View 4 Replies
View Related
Jan 1, 2010

I want to write the following worksheet function in VBA. In cell B1 : =IF(OR(A1={1,2,3,4,5,6,7,8,9,0}),"Yes","No").

View 3 Replies
View Related
Dec 24, 2012

My Columns are as follows:

A1-Criminal Name, B1-Crime, C1-Age, D1-Ratings, E1-Punishment

In the punishment column one will get 22 years life imprisonment if he fulfills the following conditions.

1. He must have done Rape OR Murder

AND

2. His Age should be >30

AND

3. His Ratings should be>8

It should throw 22 years in the Punishment column only if the above conditions are met otherwise it should be Nil.

More Info on this:

1. Crime column includes Murder, Rape, Robbery, Assault, Kidnap etc

2. Age column ranging from 22-75 years.

3. Ratings column ranging from 1-10 points

4. There are 3400 records we have in the list

How to write an IF AND OR combination formula for this ?

View 9 Replies
View Related
Sep 9, 2013

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.

IF(OR((A2="1A",A2="2A",A3="3A",AND(IF(OR(B2="Q4 2013",B2="Q1 2014"),"Y","N")

View 2 Replies
View Related
Mar 8, 2014

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.

View 1 Replies
View Related
Jan 23, 2007

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.

View 6 Replies
View Related
May 16, 2009

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.

ABCDEFG5DateD.IDAmountNODiff2TimeZone62-May-091001 500 50 - 1:50P-172-May-091002 10,000 120 - 1:15P-182-May-091003 2,000 100 - 1:15P-192-May-091111 300 40 - 1:50P-2102-May-091112 100 20 - 1:50P-2112-May-091113 234 100 - 1:50P-2122-May-091114 124 80 - 1:50P-2132-May-091211 380 3 - 1:00P-3142-May-091212 908 50 - 1:50P-315 Average1:14 16 Total Pins10191 17 18 ZoneRequest Count 19 P-13 20 P-24 21 P-32 22 Total9

Spreadsheet FormulasCellFormulaF19=COUNTIF($G$6:$G$14,E19)F20=COUNTIF($G$6:$G$14,E20)F21=COUNTIF($G$6:$G$14,E21)F22=SUM(F19:F21)

Excel tables to the web >> Excel Jeanie HTML 4

View 9 Replies
View Related
Apr 16, 2014

Power.jpg I must write a double interpolation formula for the table.

View 6 Replies
View Related
Dec 1, 2008

I need to work out the profit margin from goods i sell.

I have cost A2

Pack size A3

Net cost A4

Tax A5

Gross price A6

I need to work out the margin between A5 and A6.

View 10 Replies
View Related
Aug 16, 2009

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.

View 3 Replies
View Related
Aug 7, 2012

If the total is >= to x but =(I10*0.9),"Over 90% spent",IF((M10+T10+AA10+AH10+AO10+AV10+BC10+BJ10)>=(I10*0.8)&(M10+T10+AA10+AH10+AO10+AV10+BC10+BJ10)

View 3 Replies
View Related
Sep 22, 2013

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?

View 3 Replies
View Related
Mar 2, 2009

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

View 2 Replies
View Related
Mar 14, 2013

how to write vba code using vlookup formula insert pic from picture folder

View 5 Replies
View Related
Nov 2, 2011

I'm trying to write a formula that will count the number of unique occurrences in a column, if a specified value is found in a different column.

So I want to count the number of unique values in the "ID" column if let's say the text "NameA" appears in the "Name" column.

ID Name 12345

NameA

NameB

NameA 12346

View 5 Replies
View Related
Sep 28, 2011

how to write a formula that will leave a cell blank if nothing is entered. I do not want it to show a 0 unless the cell entered is a 0.

In cell G16 - I am adding U46 and U58 together.

I do not have a problem when it is 1 cell - my formula works fine. When I have 2 cells added together, the formula does not work.

View 7 Replies
View Related
Aug 9, 2007

I am trying to write a macro that will insert a formula directly into the cells in column M of my worksheet.

The worksheet has about 3400 rows. When I run the macro it does not adjust the cell reference in the formula so I am getting the same value in all 3400 rows.

I am using the following ....

View 9 Replies
View Related
Jul 26, 2009

I'm wondering if an if then else function can be written for the problem that I'm having? Or is there a better way to accomplish this? I've detailed my problem within the example attached.

View 3 Replies
View Related
Sep 9, 2009

I have a question, that could be answered by the experts in this forum. Question: I need to write the letter "E" in the second column (B) when I find that any cell in a row is in orange color (color 44). The code I wrote:

View 3 Replies
View Related
May 11, 2012

I have a checkbox that hides a range of columns when deselected and unhides the range when checked. I also want the code to write a value (1) to a cell when hidden and change the value to another value (0) when unhidden.

The range is hidden and unhidden perfectly, but the value "1" is written and doesn't change regardless of whether it is hidden/unhidden. (the value flicks momentarily to "0" when unchecking).

Code:

Private Sub cbTermPrev1_Click()

If cbTermPrev1.Value = True Then Range("Term_Prev1").EntireColumn.Hidden = False

Range("HiddenValPrev1").Value = 0

If cbTermPrev1.Value = False Then Range("Term_Prev1").EntireColumn.Hidden = True

Range("HiddenValPrev1").Value = 1

End Sub

View 2 Replies
View Related
Feb 9, 2007

Excel is a new program for me sorry to say it but i have been try to figure out how to write a schedule on it and tally the hours for each employee i have them set up in rows right now and i hope i can keep it that way but i am tired of add hours up for each employee every week i'm sure it is really easy but can some one let me in no the little secret

View 9 Replies
View Related
Sep 1, 2007

I recived the small job of making a template for my company for travel. I had spare time so I added in a feature so they can just e-mail it to the approite person from clicking a command button intead of taking the time to click the built in excel e-mail function and typing the addresse.

Anyway, this from tells the person who it is being e-mail to, what flights to book.

I have differnt command buttons to bring up differnt airline webpages, bascially a hyperlink but in command button form. Is there a way, just because i have time, to take the flying dates from excel, input them into the webpage which the command brings up, and search for the flights for that date, just by clicking a button in excel?

I am using excel VB for the little code I have

View 9 Replies
View Related
Dec 9, 2008

i have accumulated a lot of data on an excel sheet now i need to be able to run 2 reports that will spit out the data in a specific way but i have no clue but i have made a word document to show how i would like it to spit out

View 9 Replies
View Related
Jun 28, 2009

I am having some trouble setting up an excel spreadsheet. I dont know alot about this kind of thing so if it comes out confusing i apologise.

what i need to do is the following:

1. I need to have a cell which holds a range of data for example between 7.5 and 7.99, then the next cell 8.0-8.49 etc. How would I go about doing this?

2. I then have 2 tables side by side. on the first table i want to be able to write a number in, say 7.6, and once i enter this number i need in the second table for it to have sorted which of the above fields it fits into. I know you can have colours for each field, and that is the way i would identify which data range it fell into.

View 12 Replies
View Related
Apr 22, 2014

I need to have the counter to count every row consecutively, but to write the consecutive number in the first cell in every fifth row.

F.e. A$1$ should have the number 1 but A$6$ should have the number 2 and so on.

View 5 Replies
View Related
Feb 17, 2014

I was given the code below which works for "sheet1",but when adapted it to write to sheet repairs as well, nothing writes to sheet "repairs", have tried different codes that works writing to 1 sheet , but am having trouble writing to both sheets from a macro,i know it can be done

[Code] .....

View 6 Replies
View Related
Jan 26, 2007

I have one cell that contains a function. Sometimes I want to change the value in the cell because the value is used in another function in the sheet.

The problem is that I want the function to reapear in the cell when I press the deletebutton.

Exampel:

1. Cell A1 contains this function.

=Sumproduct((part_number>100)*(Price>10);Stockvalue)

This returns a value that is used in other cells in the sheet.

2. Now I want to try what happens in the other cells if the value in cell A1 is changed.

I select cell A1 and writes the new value that I want to test.

3. If I want the function back I simply should select cell A1 again and press delete.

4. A VBA macro now writes the original formula back into Cell A1.

View 10 Replies
View Related