3 conditions with nested if and AND function in Excel - excel

Iam simply trying categories some values, if satisfies some conditions.
if a student get mark according to the plan , I need to show correspond plan.
like this,
if the student satisfies plan 1 condition,
Result want to be Plan1
if the student satisfies plan 2 condition,
if the student didn't meet above 2 conditions, then show "NO PLAN"
I used this formula,
=IF(AND(H86>=200,Q86>=250,Y86>=14,AD86>=17,AI86>=18,AN86>=18),"Plan 1",IF(OR(H86>=180,H86<200,Q86>=225,Q86<250,Y86>=13,Y86<14,AD86>=15,AD86<17,AI86>=16,AI86<18,AN86>=16,AN86<18),"Plan 2","NO Plan"))
In this formula, the 2nd if contains 2 conditions, if the mark is between plan 1 and plan 2 we need show Plan 2 also if mark is greater than and equal to plan 2 , we need to show Plan2. here iam stuck.

Related

Group Shared Expense Calculator using Excel

I want to track the expenses of me and my friends with excel. I have the following table structure:
Date
Amount
Paid By
Split Type
Name 1
Name 2
Name 3
...
16.05.
4.99$
Name 1
Split Equal
...
16.05.
10$
Name 1
Split Unequal by Percentage
50%
50%
...
18.05.
10$
Name 3
Split Unequal by Amount
2$
6$
2$
...
The goal is, to create a matrix-like table where you can easily read which person owes another. By using a simple excel table with big, nested formulas & try and error I was able to successfully accomplish this. However, I'm curious whether this would be doable using Pivot Tables, since they are very powerful and I always feel like "they can do everything" (and the formulas are neither nice nor easy to maintain in the future).
So for the above example, the desired result could look like this (I guess the way you get there should be pretty obvious):
Name 1
Name 2
Name 3
Name 1
-
-
0.34$
Name 2
6.66$
-
6$
Name 3
-
-
-
Question
So in short, my question is: Is there a way of creating the second table based on the first one (and maybe additional "helper" tables) using Excel's Pivot funcitonality? I would be really happy to get answers / tips for this. It would also be sufficient if you show me one case (i.e., split unequal by amount) and I'll implement the other cases based on that.
What I've tried so far
As already stated above, using a plain table I was already able to solve this task. However, the solution doesn't seem to be very elegant and thus I tried to accomplish it with by using a Pivot Table. I created one but I already struggle to get the same names in the rows & columns. If I get this working somehow, the next step would be to compute the correct values in the cells (I assume by introducing a new measure and a DAX-Formula, but I have no idea how :D)
Thanks for your help and feel free if you need more information!
Edit 1: Clarify the Result Matrix
As Jos stated, the result matrix maybe isn't that obvious unlike I throught, so I'd like to give one example:
Name 1 owes Name 3 0.34$ - why?
Name 1 pays 4.99$ and this should be split equally (thus in particular name 3 owes name 1 1.66$.
Name 1 pays 10$, however this doesn't account to name 3 since only name 1 and name 2 have to share this money
Name 3 pays 10$ from which name 1 ones him 2$, name 2 6$ and name 3 2$.
In sum, name 3 owes name 1 1.33$ from the first payment, and name 1 owes name 3 2$ from the third payment. This can be summarized by: name 3 owes name 1 1.66 $ - 2$ = -0.33$ (which is the same as saying name 1 owes name 3 0.33$

Count number of products between dates, if condition matches

I am doing an excel template to count the number of outstanding insurance claims by product group.
I have an excel table with 3 columns:
Product Group
First notification date (MM/DD/YYYY)
Status (OPEN, CLOSE, REOPEN)
The results table will have 5 columns:
Product Group
less than 1 Year
1-3 Years
more than 3 Years
So basically I need to lookup each product group between certain dates where Status = OPEN or REOPEN.
I am not sure how to combine VLOOKUP and COUNTIF to achieve this.
Here is an image of the 2 tables:
You can use FILTER if you have the newest version of Excel.
For example, where your data runs from A1:C100 and where your product group is in column F, try:
=SUMPRODUCT(--NOT(ISERROR(
FILTER($C$3:$C$100,
(($A$3:$A$100=$F3)*
(($C$3:$C$100="OPEN")+($C$3:$C$100="REOPEN"))*
(($B$3:$B$100<=DATEVALUE("7/31/2020"))*($B$3:$B$100>DATEVALUE("7/31/2018"))))))))
Note the SUMPRODUCT(--NOT(ISERROR( counts only the filtered columns that don't return an error, and that you can add another criteria to the date section with "*" as needed
If you don't have the newest version, COUNTIFS could help. But be careful, COUNTIFS only supports "and" logic, so you will not be able to directly check if your criteria is either "OPEN" or "REOPEN". As a workaround for this specific case, we can test whether the criteria is not "CLOSE". For example:
=COUNTIFS($A$3:$A$100, $F3,
$C$3:$C$100, "<>"&"CLOSE",
$B$3:$B$100, "<="&DATEVALUE("7/31/2020"),
$B$3:$B$100, ">"&DATEVALUE("7/31/2018"))

Excel 2010 user. What forumla should I use for my problem?

I have 50 states to assign to three sales directors.
Using Excel I have tried, and failed to use nested IF formulas.
When a new sales lead is added, I want the appropriate sales director for the state to be assigned. For example, lead in NJ gets assigned to director X, lead in CO gets assigned to director Y.
I have the states broken down on the spreadsheet in their own columns.
Ex W3-W20 for Sales Director X, but I can't get the formula to work. I keep getting a #Value! error.
Here is what I have tried:
Attempt 1
=IF(B844=(W3:W20),"Rosado",IF(B844=(X3:X24),"Votaw","Snorty"))
Attempt 2
=IF(B844=W3:W20,"Rosado",IF(B844=X3:X24,"Votaw","Snorty"))
Attempt 3
=IF(B844="W3:W20","Rosado",IF(B844="X3:X24","Votaw","Snorty"))
Attempt 4
=IF(B844=(NJ,CT,NY,VT,DC,VA,MD,ME)"Rosado",IF(B844=CO,MT,CA,NV,AZ,OK,KS,UT,TX)"Votaw","Snorty"))
I've tried about 10 other versions of the above but can't get anything that works.
I expect that when a state is entered in one field (ex:J844) that the correct sales director assigned to that state auto-populates in another field(ex:L844)
One way, In a separate sheet (ideally) you have a lookup table of states, say in column A, and the Director's Name associated with each state in Column B.
Personally I'd create a named range for this table and then the equation in L844, per your example, is a simple VLOOKUP(J844, TheNamedRange, 2, FALSE) where TheNamedRange could be defined as, for example, Sheet2!A1:B50 or whatever your needs may be.
So, shown both methods here, index with match for the director and vlookup for the abbreviation:
I would have the table of data (cells A1 to C8 for me but larger for you) on a separate sheet (or even a separate workbook) - the functions will still get the results...

Understanding a lookup formula used to calculate balances based on transactions

Below I was given the following formula to lookup the last transaction in an account (there is a total of 4 accounts) and calculate its current balance based on the transaction of the current row (in this case row 1075). $E$2:$E1074 is the range for the varrying accounts. $F$2:$F1074 is the range of balances associated with each of those accounts. $C1075 is the current transaction we are looking at on row 1075. The error is included in the case that the account in column E does no match an other account in column E and therefore is a new account and the first transaction for that account. This code works.
=IFERROR(LOOKUP(2,1/($E$2:$E1074=$E1075),$F$2:$F1074)-$C1075,-$C1075)
I have experience with vlookup and hlookup but I don't understand the first two sections of this lookup function. specifically the 2 and the 1/($E$2:$E1074=$E1075). I'm not sure what these two values calculate and output to give the desired result. Thank you in advance for your help
Why 2 is for much the same reason as why a "big number" or "big text" (say zzz) can be useful in a MATCH function (that I tried to explain here). Here any number larger than 1 would serve since the objective is to look for what does not exist in order to make the search continue through to the last entry. Returning that last entry, rather than an error for "Not found" may not have been intended - but can be very useful.

Rank the top 5 entries in different criteria

I have a table that I want to find the top X people in each of the different groups.
Unique Names Number Group
a 30 1
b 4 2
c 19 3
d 40 2
e 1 1
f 9 2
g 15 3
I've ranked the top 5 people by number by using =index($A$2:$A$8,match(large($B$2:$B$8,1),$B$2:$B$8,0)). The 1 in the LARGE function I linked to a ranked range so that when I dragged down it changed up the number.
What I would like to do next is rank the top x number of people in each group. So top 3 in group 1.
I tried =index($A$2:$A$8,match("1"&large($B$2:$B$8,1),$C$2:$C$8&$B$2:$B$8,0)) but it didn't seem to work.
Thanks
EDIT: After looking at the answers below I have realised why they are not working for me. My actual data that I want to use the formula with have multiple entries of numbers. I have adjusted the example data to show this. The problem I have is that if there are duplicate numbers then it returns both of the names even if one is not in the group.
Unique Names Number Group
a 30 1
b 30 2
c 19 3
d 40 2
e 1 1
f 30 2
g 15 3
Proof of Concept
Use the following formula in the example above in cell F2 and copy down and to the right as needed.
=IFERROR(INDEX($A$2:$A$8,MATCH(AGGREGATE(14,6,($C$2:$C$8=F$1)*($B$2:$B$8),ROW($A2)-1),$B$2:$B$8,0)),"")
In the header row provide the group numbers. or come up with a formula to augment and reset the group number as you copy down based on your X number in your question.
Explanation:
The AGGREGATE function unlike the large function is an array function without the need to use CSE. As such we can add criteria to what we want to use. In this case only 1 criteria was used and that was the group number. in the formula it was the following part:
($C$2:$C$8=F$1)
If there were multiple criteria we would use either an + operator as an OR or we would use an * operator as an AND.
The 6 option in the aggregate function allows us to ignore errors. This is useful when trying to get the small. It is also useful for dealing with other information that may cause errors that do not need to be worried about.
As this is technically an array operation avoid using full column/row references as they can bog down your system.
The basics of what the over all formula is doing is building a list that match the group number you are interested in. After filtering your numbers, it then determines which is the largest, second largest etc by what row you have copied down to. It then determine what row the nth largest number occurs in through the match function, and finally it returns to the corresponding name to that row with the index function.
Building on all the other great answers.
Because you have the possibilities of duplicate values in each group we need to do this with two formulas.
First we need to get the numbers in order. I used the Aggregate, but this could be done with the array LARGE(IF()) also:
=IFERROR(AGGREGATE(14,6,$B$2:$B$8/($C$2:$C$8=E$1),ROW(1:1)),"")
Then using that number and order we can reference, we can use a modified version of #ForwardEd's formula, using COUNTIF() to ensure we get the correct name in return.
=IFERROR(INDEX($A$2:$A$8,AGGREGATE(15,6,(ROW($B$2:$B$8)-ROW($B$2)+1)/(($C$2:$C$8=F$1)*($B$2:$B$8=E3)),COUNTIF(E$2:E2,E3)+1)),"")
This will count the number in the results returned and then bring in the correct name.
You could also solve this with array formulas - to filter a group whose name is stored in E1, your code
=INDEX($A$2:$A$8,MATCH(LARGE($B$2:$B$8,1),$B$2:$B$8,0))
would then be adapted to
=INDEX($A$2:$A$8,MATCH(LARGE(IF($C$2:$C$8<>E1,-1,$B$2:$B$8),1),$B$2:$B$8,0))
Note: After entering an array formula, you have press CTRL+SHIFT+ENTER.
Thank you to everyone who offered help but for some reason none of your methods worked for me, which I am sure was to do with the quality of my data. I used an alternate method in the end which is slightly convoluted but seemed to work.
=IF($C2="1",RANK($B2,$B$2:$B$8,1)+ROW()/10000,-1)
Essentially using the rank function and adding a fraction to separate out duplicate values.

Resources