Sum With If Using Array Functions Or Sumif With VLookup
Apr 7, 2014
In sheet1 I have name(column A) and value(column B)
In sheet2 I have name (column C) and key(column D)
In sheet 3 I have results
Example ( It is just a total nonsense example, the real data is net inflow of some funds that are unique)
Sheet1
House 1000
Car 1500
pet 2000
Sheet 2
house1
car1
pet2
So in the sheet 3 I want to put a formula that is capable to sum all values of the sheet2 if the name has a key of 1in the sheet2, the key columns has values of 1 or 2
I think in SQL will be something with join and group by with having clause.
The result will be 2500 in the sheet 3.
What I tried: My attempt is to do something like this code ( using array functions).
View 7 Replies
ADVERTISEMENT
Jan 8, 2009
I have an entire excel column which was filled-in with values ranging from 1000 to 40000. What I was trying to do is to just sum up the all the values which are between 9000 and 20000. I tried using the sumif function =sumif(and(A5:A40,">9000"),(A5:A40,"<20000")) but it does not work, it says that the formula that I typed contains an error.
View 4 Replies
View Related
Feb 20, 2007
I have a block of data spread across 5 columns (A-E)
Data in column A is unique to each row . Data in Column B is a name (text) that repeats occasionally, C, D, & E are numbers.
I would like some formula or macro that will detect duplicates in column B and sum the corresponding data (in columns C,D,E). I am not sure how to work the sumif function (assuming that is what will work in this case).
Now the tricky part is that I want the count of how many times names in column B occured to appear in column F.
Basically I would a new block of data with B,C,D,E and F as an output.
View 9 Replies
View Related
Dec 5, 2008
I am trying to create a custom function to act much like the database capabilities of excel in summing a column based upon multiple criteria of other columns. First, before I get too far, does anyone have an already built custom VBA function that will accomplish this? I find that using the built-in database functionality in excel is VERY slow!
Anyways, I am trying to pass an argument that contains multiple ranges (much like you can do with the SUM() function):
=MultipleSUMIF("E11:E14, F11:F15", "A1, E1", G11:G14)
The first set of arguments is the ranges that I need to look through. The second set of arguments is the values that I need to search within the first two ranges. The third argument is the column that I need to perform a SUM function on.
Instead of doing this, how can I create a function that will allow me to say, "Add another criteria range/value" and it will add another criteria to the list. I am currently passing a string, and that is not ideal, obviously.
View 9 Replies
View Related
Apr 28, 2014
SUMIF and SUMIFS formula, where in I want to set criteria in the formula as greater than or less than or equal to value derived from another formula. I am inserting the following formula but excel is not allowing me to enter the formula.
=SUMIFS($C$22:$C$30,$E$22:$E$30,>=LEFT(L21,3),$E$22:$E$30,<=RIGHT(L21,3),$A$22:$A$30,G22)
View 3 Replies
View Related
Jun 13, 2009
I occasionally see array and/or sumproduct formulas that incorporate symbols that I don't really understand in an array context.
These symbols include:
* (asterix)
| (vertbar)
. (period)
; (semicolon)
Also: are there other powerful symbols that have meaning in an array or sumproduct context?
View 3 Replies
View Related
Dec 9, 2008
I have a list of part #s that i need to group together and sort by their corresponding dates. The formula I've written does what I'd like it to do (assign a value to part groups that i can sort by first before sorting by the date) , but is too large/has too many nested functions to be applied. This formula is going to be used with multiple queries from a database that updates regularly.
EXAMPLE OF DATA(6000+ entries)
http://www.excelforum.com/attachment...1&d=1228860131
This is the breakdown of my formula, I've bolded the parts that aren't constant
=IF(AND(LEFT(D2,5)>="S2000"LEFT(D2,5)<"S2005"),1,IF(continues)...................
View 3 Replies
View Related
Sep 15, 2012
What I am trying to do is to automatically build a "tree" diagram representing the links in a huge model which is dynamically configured. What I have a problem with is the following:
The tree consists of layers, I start off with the top layer and for each entry in the top layer I can add all its subsidiary layers and draw links between them, this uses a function which takes as its arguments the node name and its layer number (how far down the tree it is) and the number of items in that layer so far.
So I start at the first item in Layer 1 and there are as yet no layers below it. I start at the first one and add the first item in layer 2 then I kick the function off again and that adds the first item connected to item 1 in layer 2 in the layer below (3) starting at the first one, and so on. When I reach the bottom I go up one layer and add the second item in the bottom layer and so on. When I have added all the connctions to the first item in the next to bottom layer I go up one layer and add the second item connected to the first item in that layer and then add all the items connected to it and so on and so on.
In this way I build up the network exhaustively (to make things more complex more than one item in a layer may connect to the same item in the layer below).
I can do almost all that, the issue I am struggling with is I need to keep track of how many items there are in each layer (as some layer 1 items connect to 1, 2, 3 ...8 layer 2 items and so on). my idea is to keep a running total of these in an array LevelCount(1), LevelCount(2) etc. so when I add a new item to a layer I know where to put it. However I cant workout how to do this final step.
Currently I have a function that draws the nodes below a specified node this and takes the correct value from the array LevelCount(n) by passing Levelcount(n) (where n represents how far down the tree you are) into the function and the function then updates the value of LevelCount(n) (ByRef) so that next time I use it it is correct. That is fine but what I want to do is to is to call the same function from within itself when it adds each node which would make it work automatically - it would keep calling instances of the function until it reached bottom and then go back one step at a time to the top but I cant work out how to reference the right value in the array to pass into the second (and subsequent) instances of the function.
I don't think I can simply pass (n) into the function and in the body of the function set LevelCount(n) = LevelCount(n)+1
I also dont know ahead of time how many layers the model will have, nor can I tell which layer a node sits in as it depends on the links that are dynamically configured.
Beyond this a node can also be subsidiary to nodes in more than one level so it needs to sit at the lowest level - but I suspect if I can work out how to do the first bit i can do this too.
View 7 Replies
View Related
Aug 25, 2007
I'm trying to write a macro that looks up Column A so that each time it finds "Agent" as the first word in a cell, it takes that whole cell and copies it to another sheet.
I tried creating an array function that combines the If, Vlookup, and Right() and Left() functions, but no luck. Ideally, I would want this as a VBA macro.
View 9 Replies
View Related
Sep 30, 2009
IN NEED HELP WITH vlookup FUNCTIONS:
1-st table
ABCDEF12221.985
2-nd table
>40
0.1
40
View 9 Replies
View Related
Nov 19, 2009
I have an array with dimensions (5000,30). I want to perform a worksheet function "Percentile" on specific columns within the array. So for instance I may want to know the element falling at the 50th percentile in column 5 of the 30 column array. Is there a way to do this without having to place the array onto a worksheet?
View 4 Replies
View Related
Sep 20, 2007
I have a spreadsheet with over 20,000 rows. From another spreadsheet I need to find if any of a list of 90 customers are within the first, using a simple IF and vlookup formula which comes back yes or no.
I am using: =IF(A2 = VLOOKUP(A2,ihcust!B:B,1),"YES","NO")
However, although this works when they are spelt exact in both sheets if they are not it will say no.
eg. If I was Looking up "Joe's Icecreams" from the list of 90 but in the other sheet it is listed as "Joe's Icecreams (admin)" it would not recognise it and come back no.
Is there away to get around this problem
View 9 Replies
View Related
Nov 27, 2009
need a mix of the vlookup and sumifs functions! (well I think at least!)
I want to find Cell A in Column 1 AND Cell B in Column 2 (like a sumifs) and then return me a value in a range (as a normal vlookup would)
Basically a vlookup matching two cells/columns rather than one
View 9 Replies
View Related
May 1, 2007
I have made an input form which the user can input the data of person they wish to sit.
I then used Vlookup to put this data on to a smaller table.
This will make more sense on this download of the program.
http://files-upload.com/199899/MainInput.xls.html
What my problem is....is that i have too rooms and i needed excel too look at the cell see that they want to sit in room one then it looks at what table they want to sit at then looks at the seat they want to sit at then put them there.
View 9 Replies
View Related
Dec 13, 2006
All I am doing is counting text values in a table.
The table has 3 main columns(which are relevant to this thread anyway).
Shift - Area - Status
The example I have attached shows examples of DCOUNTA, SUMPRODUCT and a Pivot Table.
I have read many threads stating that the best one to use is Pivot Table followed by DCOUNTA followed by SUMPRODUCT.
The most effective for me seems to be SUMPRODUCT (although this does slow excel down dramatically when you use a lot of these formulas). As do Array Formulas
The Pivot Table does not update on its own, therefore constantly needs to be refreshed. (I could use code to do this)
The DCOUNTA seems to be the least effective at doing what I want (unless I am doing something wrong)
In the attached example can the DCOUNTA be used more efficiently as I don't like the fact that I am duplicating rows to apply the criteria for a different shift. e.g
Area 1 - Late Shift - Banned
Area 1 - Early Shift - Banned
I want my table to be as follows (as the SUMPRODUCT shows)
AREA - Early Shift - Late Shift - Night Shift - Area Total
Area 1
Area 2
Area 3
Area 4
Area 5
Shift Total
View 4 Replies
View Related
Jul 13, 2006
I have drop down fields using a vlookup to grab the corresponding data in a colums next it which is being concatenated into a one big cell. The problem is a set of other columns that I need to pull data from but its dependant to a previous column. In the attachment you see which ever region is selected the following column data is grabbed and the same goe for title. Now when the location is selected the info in its column should be selected that corresponds to the row that the specific title is on. example
if selected: North America>Secretary>Texas
results: A Crazy Mix->;typical,Notepad, pen,square dance
View 7 Replies
View Related
Jul 18, 2007
I am trying to obtain price of an item using vlookup() function on the identifier 0003128 (7 digits) stored with custom format 0000000 in one worksheet. However in other worksheet, the identifier is stored as 000312 (6 digits) with text format without the last digit 8. I tried using the left(A,6) function on 0003128 but instead of returning 000312 it returns 3128 and Im unable to use the vlookup() function.
View 6 Replies
View Related
Aug 18, 2009
I have a Vlookup which I want to modify so that it can become dynamic as the table array part of the vlookup will change.
So the basic vlookup is as follows:
=VLOOKUP($R$3,ATTRIBUTION_FACTSET!$M$60:$P$73,2,0)
but the data I am looking for wont always be in the range M60:P73.
So I tried to make it dynamic by doing the following:
=VLOOKUP($R$3,INDIRECT("ATTRIBUTION_FACTSET"&"!M"&U1&":P"&V1),2,FALSE)
The idea being that U1 and V1 would be numbers that can change so in this case U1 would equal 60 and V1 would equal 73
This vlookup is giving me #N/A and no matter how I modify it I cannot get it to work.
View 3 Replies
View Related
Nov 5, 2008
I've been manually writing IF statements out for ranges of data that could easily be done with a little array work. So I set out to convert all my functions into something more readable and quicker to write. But I ran into a problem. I want to add the values of an array G45:Z45 if the corresponding values in G44:Z45 are less than or equal to P41. So I thought to use a SUMIF:
=SUMIF(G44:Z45,<=+P41,G45:Z45)
That didn't work, in fact, it didn't come error free until I did:
=SUMIF(G44:Z45,"<="+P41,G45:Z45)
But that doesn't add anything up either. From what I can see, the problem lies within the condition. If I simply put P41, it works. The moment I add <= I get a multitude of problems.
View 2 Replies
View Related
Feb 7, 2008
I am preparing an analysis of my company's expenses for the last two years by account. One on excel sheet I have the raw data,
bank account, payee, payment date, clear date, amount, payment type
(This is from all accounts for the whole 2 year period.)
In the second sheet, I have a summary schedule setup. The summary is setup like this:
Account #
Row 1: Begin Date
Row 2: End Date
Payment Type 1 AAAAAAA
Payment Type 2 BBBBBBBB
I would like to come up with a formula that will populate AAAAA & BBBBB for a given account during a given time period. For example, I would like it to give me the total of Type 1 payments from account 12 during the period January 2, 2005 through January 27, 2006.
Right now it is only giving me the info for 1 payment type and 1 account. Here is what I have now {=SUM(IF(Detail!$G$10:$G$3942>=R$5,IF(Detail!$G$10:$G$3942
View 10 Replies
View Related
Sep 18, 2007
does the SUMIF worksheetfunction in VBA work on Arrays? I know it will work on ranges, and thats all fine, but I am convinced it should work on an array too... for example... Just assume two columns of numbers (A and B) with 13 rows -
Public Sub test()
Dim a As Range, b As Range
Dim x, y
x = ActiveSheet.Range("A1:A13").Value
y = ActiveSheet.Range("B1:B13").Value
Set a = ActiveSheet.Range("A1:A13")
Set b = ActiveSheet.Range("B1:B13")
MsgBox Application.WorksheetFunction.Sum(x) 'works
MsgBox Application.WorksheetFunction.Sum(y) 'works
MsgBox Application.WorksheetFunction.SumIf(x, "1", y) 'wont work - "Object Required"
MsgBox Application.WorksheetFunction.SumIf(a, "1", b)
End Sub
I also tried Transposing the x and y arrays, but the same result "Object Required".
View 4 Replies
View Related
Sep 25, 2009
My excel (2003) is stuck in array mode - is there any way to get it out of Array Mode and put it back in the letter:number display for formulas/functions? It's doing this in VBA too which is totally killing me.
View 2 Replies
View Related
Oct 2, 2008
XL 2003
I want to combine these three functions
=VLOOKUP(e4,AGTNAME!$A$1:$E$3086,5,0)
=LEFT(E4,FIND("/",E4)-1)
and iserror
View 9 Replies
View Related
Oct 29, 2012
I'm trying to do a Vlookup on a file that gets automatically downloaded to the computer from a website. The data is in lots of different data sets, like so:
Loans to countries
Mar
Apr
May
Jun
Loans to banks
Mar
Apr
May
Jun
Every month a new row of data gets added to each table, meaning the start and end cells of the array also shift each time.
View 4 Replies
View Related
Jan 15, 2010
I've hit a major brick wall and hoping someone will be able to help! I've written an array formula to replace a pivot table (long story) anyway, they now want to be able to filter the data by date (between two dates) i'm using the current formula:
{=SUM(IF('SAP Data Current'!$A$2:$A$39802='Payment Block by Ac. Clerk Cal'!$B$84,IF('SAP Data Current'!$I$2:$I$39802='Payment Block by Ac. Clerk Cal'!$C101,IF('SAP Data Current'!$B$2:$B$39802='Payment Block by Ac. Clerk Cal'!S$2,'SAP Data Current'!$AA$2:$AA$39802,0),0),0))}
I know I need to put it at the beginning, but not sure how! I have the following formula for between dates:
=SUMIF(B2:B24,"<="&F7,C2:C24)+SUMIF(B2:B24,"<="&F8,C2:C24)
but then this isn't working right either!
View 13 Replies
View Related
Jul 19, 2013
I currently have a Row with this value
row1 lh lh lh
row2 8 12 8 5 2
First I will need to check if the column has an "lh" if true then sum row2, however i will need a second condition that will check that if >8 it will use the value 8 instead of 12.
However if value is<=8 get that value from the cell.
In this case the correct answer is
8 + 8 + 5 = 21
8 (because it is <=8 get the value from the cell) + 8 (because 12 is>8 use the value "8") + 5 (because <=8)
View 3 Replies
View Related
Sep 22, 2009
I have a workbook containing 2 tabs.
Tab 1 has columnar data with column A containing locations; however, each location may be listed multiple times on different lines - once for each piece of equipment at that location. Tab 1, column B has a piece of equipment listed. Tab 1, column C has a price associated with the piece of equipment in column B.
Tab 2 contains contains columnar data with column A containing locations. I need to populate Tab 2, column B with the sum of all equipment associated with the location in column A.
I have used VLOOKUP to try and find matches for the lookup_value in Tab 2, column A, then return the value of the price from Tab 1, column C.
Problems have been that it returns only the first instance of the location data, not a sum of all. I know the formula is missing something, but cannot ID it.
Formula as used:
=VLOOKUP(B4,'Tab 1'!$I$4:$AI$461,3)
B4 is the column on Tab B that contains all of the locations (lookup_table)
Tab 1 I4 thru AI461 is the table_array where all locations are listed
3 is the col_index_num indicating that the price is in the 3rd column over
View 14 Replies
View Related
Jul 24, 2014
I have a download from an accounting general ledger which has the following:
Column A: Category Description
Column B: Country
Column C: Department
Row 1: Months
Note: Each row contains the last 12 months worth of costs
As the categories/criteria can appear multiple times, and there are thousands of lines, I have been using SUMIFS to calculate totals my required combinations (eg. Travel expense, Germany, Sales department)
Every month, the information refreshes to show the most recent 12 months worth of data. And this means I need to manually update my formulas to correct the month column headings, as everything moves by 1 month.
Would something like a SUMIF with a SUMPRODUCT work? Eg. if current month = July, then it would sum everything from the July column automatically?
View 4 Replies
View Related
Feb 10, 2014
I have a list of Items and the quantities of those items on one sheet. Each item has a section location number as well. (three Columns, Item, Quantity, and Section Location). the list can repeat the same item multiple times.
This is why I then have a summary sheet to uses a SUMIF formula to sum the quantities of a given item that are in a givin section. which my SUMIF Formula works great for. But my problem is some items have the word "LUMP" as its quantity and not a number. I want to add to my array formula so if the item does have a LUMP quantity and the lump quantity is in the section location to put LUMP on the summary sheet. here is my formula
=SUM(IF((ProjectInfo!$AE$2:$AE$307 =$B59)*(ProjectInfo!$AD$2:$AD$307= AA$10),ProjectInfo!$AF$2:$AF$307,""))
projectInfo is the sheet where the list is. Column AE is the Item column on the projectinfo sheet column B on the summary sheet would be the item that i want to sum the quantities for Column AD is the section location column on the projectinfo sheet the AA$10 is the row and column of the section location i want to limit the sum of the quantities to the formula is in cell AA59 So it will sum all the quantities in the list on the projectinfo sheet if the item and section location match whats specified on the summary sheet.
getting LUMP to display if its a lump quantity. The Lump can only show up if the item on the projectinfo sheet has LUMP for that Item AND in that section location.
EDIT: Column AF on the ProjectInfo Sheet is the quantity column
View 5 Replies
View Related
Jan 14, 2009
I would like to have a formula in one cell that finds records on another sheet that meet certain criteria, and produces a sum of the total quantities associated with that record. The attached workbook has more details as to what I am trying to do.
View 2 Replies
View Related