Excel Ignoring If Statement During Index/Match/If/Large Command - excel

I'm trying to create a chart that finds the name of the first (then second, third, fourth, etc.) largest entry (via total sales) that meet certain criteria from a second Excel worksheet. (i.e. I want to find the largest sales value that is of the good "Apples" and sold in "Europe" if you will, as well as display the customer that this largest sales dollar amount was sold to.)
I've created some code that is giving me the name corresponding to the largest value on the sheet (very good!). However, this name does not meet the criteria in my if statement.
Example code: =INDEX('Sheet1'!B:B,MATCH(1,INDEX(('Sheet1'!V:V=LARGE(IF(AND('2. Sheet1'!E2:E1000="Apple", 'Sheet1'!W2:W1000="Europe"), 'Sheet1'!V:V, ""), ROWS(C$1:C1)))*(COUNTIF(C$1:C1,'Sheet1'!B:B)=0),),0))
B is the column with the customer name, V is the column with the overall sales amount, E is the column showing the name of the item sold, W is the name of the geographic area, C is the column (on the new sheet) where the name of the customer will be duplicated.
What I want to see is the customer who bought the most apples in Europe...but instead I'm getting the largest sales volume over all.
To make it stranger, if "apples" and "Europe" don't appear on the top row of Sheet1, I'm getting #N/A. (This does not happen, though, if these are contained in the top row.)
Does anyone have any thoughts as to how to fix?

In the following sample data image, the formulas in AB2:AC2 are:
=AGGREGATE(14, 6, (V$2:V$21)/((W$2:W$21=AA2)*(E$2:E$21=Z2)), COUNTIFS(Z$2:Z2, Z2, AA$2:AA2, AA2))
=INDEX(B:B, AGGREGATE(15, 6, ROW($2:$21)/((E$2:E$21=Z2)*(W$2:W$21=AA2)*(V$2:V$21=AB2)), COUNTIFS(Z$2:Z2, Z2, AA$2:AA2, AA2, AB$2:AB2, AB2)))
If you need to do it all in one formula, substitute the formula from AB2 (sans =) for every occurrence of AB2 within the formula from AC2.
Fill down as necessary.

Related

Trying to incorporate many conditions into one formula

so I tried building the following massive formula:
=IF(AND(S284<>"",R284<>"",A284<>B284),INDEX(RATE, MATCH($A284,BID_NO,0), MATCH($R284,RATES,0)),IF(AND(S284<>"'',R284="",A284<>B284),INDEX(SHIFT_INFO, MATCH($A284,SHIFT_BID,0), MATCH(L$4,SHIFT_HEADER,0)),IF(AND(S284="",R284<>"",INDEX(SHIFT_INFO, MATCH($B284,SHIFT_BID,0), MATCH(L$4,SHIFT_HEADER,0)) <> INDEX(SHIFT_INFO, MATCH($A284,SHIFT_BID,0))),INDEX(RATE, MATCH($A284,BID_NO,0), MATCH($R284,RATES,0)),IF(AND(S284="",R284="",INDEX(SHIFT_INFO, MATCH($B284,SHIFT_BID,0), MATCH(L$4,SHIFT_HEADER,0)) <> INDEX(SHIFT_INFO, MATCH($A284,SHIFT_BID,0))),INDEX(SHIFT_INFO, MATCH($A284,SHIFT_BID,0), MATCH(L$4,SHIFT_HEADER,0))),"")
This formula was much simpler than this before but some conditions were added that we wanted to see if it could encompass them. It attempts to encompass several scenarios on a spreadsheet regarding schedule changes. Each schedule is assigned as a bid number in column A as well as one is column B. They are always equal until someone actually changes a schedule.
The purpose of the formula is to compare the data of the bid # in column A - The new bid they are going to and the data of the bid # in column B - the old bid that they are coming off of. In this case, this particular data is rate of pay.
If the rates of pay are the same, the formula will leave the cell blank.
If they are not the same, it will give the pay rate data of the new bid so we know what the rate needs to be changed to. As I mentioned, there were some added conditions in additional columns which I am now going to list:
**Bear in mind, There are 2 tabs giving different rates of pay since employees fall into Tier 1 or Tier 2 rates depending on when they were hired. Column "R" determines which tab a lookup will pull from. If "R" is blank, it pulls info from one tab of Rates which we will call Tier 1. If "R" is NOT blank, it pulls info from a different tab of rates which we will call Tier 2.
If column "A" is equal to column "B", then column "L" (this is the column that contains the big formula) is left blank. This condition takes precedence above all others.
If column "A" is NOT equal to column "B", column "R" is NOT blank, and column "S" IS blank, then do a lookup of the bid # in column "A" for that bid's rate of pay and do a lookup of column "B" for that bid's rate of pay. If the rate of pay for both Lookups match, column L is left blank. If they do NOT match, do a lookup for the number in Column A and display that rate. Because "R" has a value, the lookup will yield info from Tier 2 rates.
If column "A" is NOT equal to column "B", column "R" is NOT blank, and Column S is NOT blank, then do a lookup of the rate of the bid number in column A, even if the rate between A bid and B Bid are identical. Again, because "R" has a value, the lookup will yield info from Tier 2 rates.
If column "A" is NOT equal to column "B", column "R" IS blank, and Column S IS blank, then do a lookup of the number in column "A" for that bid's rate of pay and do a lookup of column "B" for that bid's rate of pay. If the rate of pay for both Lookups match, column "L" is left blank. If they do NOT match, do a lookup for the number in Column A and display that rate. Because "R" has NO value, the lookup will pull from the Tier 1 rates.
If column "A" is NOT equal to column "B", column "R" IS blank, and Column S is NOT blank, then do a lookup of the rate of the bid number in column A, even if the rate between A bid and B Bid are identical. Again, because "R" has NO value, the lookup will pull from the Tier 1 rates.
Again, I tried the formula at the top to encompass all of these scenarios. I got the 255 character limit message and so I am stuck. I realize this is way past information overload, so of course if it is easier and someone is willing to help, I can attach a template of the spreadsheet so that you can actually see what is being worked with. I can also be available for instant messaging to answer questions if that helps.

Using Correl Function in Excel for Varying Array Sizes

So the current setup of the problem at hand is that I have 4 columns, Employee ID, Category 1, Category 2, and Category 3. I need to find the correlation between Category 1 & Category 2, Category 1 & Category 3, and Category 2 & Category 3 for each Employee ID. The issue is that the array length for each Employee ID is different. Some employees will have 5 records, some employees will have 8 records to their ID.
This problem would be simple if the Subtotal button had the CORREL function built into it given its grouping by feature.
How would I go about calculating the 3 correlation coefficients for each unique Employee ID? Excel function or VBA works
You need to use an array formula. Please see this screen shot of a sample situation:
As you can see the formula for cell G2 is: =CORREL(IF($A$2:$A$16=F2,$B$2:$B$16,""), IF($A$2:$A$16=F2,$C$2:$C$16,"")) That is saying if cell in column A matches your employeeId, include the cell in corresponding column in the array (Column B for the first IF and Column C for the second ID). After entering in the formula you need to make sure you hit Ctrl+Shift+Enter to tell excel you want to do an array formula or Command+Enter on a Mac.
You obviously need to modify the formula to fit the size of your data and you can copy that formula to any cells if you setup your $s correctly.

Need help in excel formula

1) I have two tables. 1st table contains data for more then 20,000 rows and 2nd table I already have the following columns details i.e. Region, Item, Number and I just have to get the Total value of the product from the 1st table
2) There are two types of prices in the 1st table . One is Retail Price and Another one is a Wholesale price
3) In each of the regions Rep, Item and Numbers are same in most of the cases, but the Total price is different
4) I am able to get the Total price details in 2nd table through vlookup formula (After concatinating the following columns i.e. Region, Item and Number from both the tables) wherever there is an account number for retail price
5) Currently I am manually updating "Total Price" details in 2nd table for Wholesale price which is taking lot of time.
Is it possible to build a formula to get the wholesale price details in the 2nd table, since there are more then one account number, but the price is same
If the wholesale price is the lowest price for the specific item, then you can find it with the formulas MIN and IF.
Based on your screen shot:
D is the column with the list of items
I5 is the cell with the item name for which you want to find the wholesale price
F is the column with the list of prices
If you enter the following formula in cell K5, it should find the lowest price for pencils
=MIN(IF(D:D=I5,F:F))
On this link, there is an explanation if you want to use multiple criteria.
http://www.contextures.com/excelminmaxfunction.html
try the sumifs function.
It takes multiple arguments and criteria. So it should look something like:
cell value at j5 = sumifs(f3:f23, b3:b23, h5, d3:d23, i5....)
you need to mark off which rows in your first table are wholesale selling. So it should be a column of some kind. Once you do that, let's say in column G, then you add onto the sumifs function...
, g3:g23, L5)
What you're doing is summing up all of the values in column F where h5 (region) matches in b3:b23, i5 (item) match in d3:d23, and where L5 (retail type) match in a new column g2:g23.
This will find all of the values that match that criteria exactly.
Vlookup is useful, but it's harder to scale IMO than the advanced if functions.
SUMIFS is probably the better way to go on this one, but as an alternative there is also SUMPRODUCT.
=SUMPRODUCT(($H3=$B$3:$B$20004)*($I3=$D$3:$D$20004)*($J3=$E$3:$E$20004)*($F$3:$F$20004))
The * acts as an AND statement in a logical check, and each of the ($H3=$B$3:$B$20004) is a logical check. When the row is true it will evaluate to 1. When it is false it will evaluate to 0. in the end you wind up with a list of prices or 0s that get summed. The end result is the sum of everything that matches your criteria.
The danger of using this formula is that it can get labour intensive as it is performing array calculations without being an array formula.

return the nearest number value above current cell within a list in Excel 2010

This is a little difficult to explain but I have a list of data, all in one column, that contains a department number and then below each department number is a long list of brands that correspond to that department number. So within this list there are multiple departments with brands listed underneath them.
My goal is to somehow return the value of the department next to each brand but because the department number is located above the list of brands and the data is changing each time I repull the report, the row numbers will not remain them same and there may be duplicate brand names, and I cannot figure out what formula to use because it is all contained in one column.
I need to come up with some type of formula that doesn't just search, but returns the value of the next number or value above the current cell and skips all of the text or blanks in between so it will grab the department number above it. Is there a way to do this or a better way to accomplish the goal of assigning each brand to the department above it while allowing for changing data each time I pull the report?
I tried replacing all of the text with 0's or blanks and then used the indirect function to say: =IF(BG24="",INDIRECT("BF" & ROW() - 1),""), but I assumed it would continue to loop and skip the zeroes or blanks until it found a number, but it did not, it just returned the zero value.
If I understand your problem correctly, the following formula should do it. Put it in cell B2. In cell A1, I'm assuming that there's the department number.
=IF(ISERROR(A1*1), IF(ISERROR(A2*1), B1, ""), A1)
This will work for a table like the following where no brands are numbers only:
1
Brand1
Brand2
2
Brand1
Brand2
To become:
1
Brand1 1
Brand2 1
2
Brand1 2
Brand2 2

Creating a Top Ten list in Excel

I have been searching for a way to make a "Top Ten" list for my uncles hockey league in Excel.
There are 5 different teams with their own worksheets and I made a separate worksheet called "data" referencing all of the players and their individual stats so that I could pull my "Top Ten" from one worksheet instead of five.
The worksheet is setup as follows:
Player1 Player2 Player3 etc...
Name
Team
Goals
Assists
Points
I would like to search for the player with the highest number of "Points" and return the name, team, goals, assists, and points on a single row, and then move down for the next player, i.e.:
Name 1 Team Goals Assists Points
Name 2 Team Goals Assists Points
I have tried using multiple ways including index and hlookup with the large and match commands, but could not get anything to work.
I feel like I am missing something simple here.
If it would be easier to have the players in rows, I could do that.
I was just having a problem with my references filling in the way I wanted them to.
Initial table:
B1: =COUNTA(B6:O6)(the number of players)
B6:O6 Name
B7:O7 Team
B8:O8 Goals
B9:O9 Assists
B10:O10 Points
Formulae below determine the rank for the player. If the score of points are equal, the player having a greater number of goals ranks higher.
B4: =$B$1-RANK(B$10;$B$10:$O$10)+B8/1000, the formula is copied to the right. The result will be fractional numbers with equal integer parts for the equal amount of points.
B3: =RANK(B4;$B$4:$O$4), the formula is copied to the right
B2: =IF(COUNTIF(C$3:$O$3;B3)>0;B3+COUNTIF(C$3:$O$3;B3);B$3)
Ranked table:
A15 and down : Rank (1,2...n)
B15 and down : =HLOOKUP(A15;$A$2:$O$3;2;FALSE)
In the next columns: Name (col C), Goals (col D), Assists (col E), Points (col F)
C15: =HLOOKUP($A15;$A$2:$O$10;5;FALSE)
D15: =HLOOKUP($A15;$A$2:$O$10;7;FALSE)
E15: =HLOOKUP($A15;$A$2:$O$10;8;FALSE)
F15: =HLOOKUP($A15;$A$2:$O$10;9;FALSE)
Formulae in B11:E11 will be copied down.
Example spreadsheet: http://www.bumpclub.ee/~jyri_r/Excel/Top_players_matrix_transposed.xls
you have to transpose the table first..
select all the rows and columns of your table.
right click the first cell where you want to paste the table
click paste special option
check the transpose check-box in the dialog-box opened.
your table is now transposed. now simple sorting can give u answer
for sorting columns :
select the whole table and click on the sort option on menu bar,
now you can retrieve all 10 top teams from this sorted list.

Resources