creating new column in excel based on conditions from two columns - excel

What formulas can I use in excel to compute column D while simultaneously matching on column A,B and C.
If the case id is the same and date is the same, then if status is approved, final status is approved. but if case id is same date is same, and if status is denied, then final status is partial denial.
Can someone please help?
I tried do if and statement but I don't know how to match on unique case IDs in the same column.

It appears there is some missing information in your query. Let me write it out similar to an Excel IF statement:
=IF(CaseSame,IF(DateSame,IF(APPR,Appr,IF(DENY,PtDeny,??)),??),??)
With the information given, we don't know what to do in all outcomes. The outcomes marked with "??" will show as FALSE, because there is no output given for those criteria. But that formula would look like this:
=IF(A2=OFFSET(A2,-1,0),IF(B2=OFFSET(B2,-1,0),IF(C2="APPROVED","Approved",IF(C2="DENIED","Partial Denial",FALSE)),FALSE),FALSE)
And even there, I'm having to make the assumptions that you intend to go off the data in the row above for "case ID is the same" and "date is the same".
Are we supposed to assume that if no other criteria is given, to use column C's answer? In that case, there is still one unknown outcome in the IF statement:
=IF(C2="APPROVED","Approved",IF(C2="DENIED","Partial Denial",FALSE))
As long as no other entry is made in Column C, that should provide consistent results.
Here are what the two statements render in the Final Status column:
Results of both IF statements against your data and instructions
I hope this helps. With clearer information what to do in all circumstances, I may be able to provide a better answer.

Related

Using VLOOKUP to match a user ID to a supervisor

As you could probably already guess, I am working on a report summary that displays the amount of time each agent has spent in different statuses such as 'Available', 'Unavailable', 'In a meeting', etc. that can easily be modified and doesn't rely on specific criteria, just the table rows & columns. For example, if someone was to switch teams or get a new supervisor, the data would be updated automatically when replacing the supervisor name.
The issue that I am having is when I try to use a VLOOKUP in my 'Report' sheet to match an agent's User ID to their supervisor in the 'Agent List' sheet, I am getting #N/A as my result.
This is the function that I have tried:
=VLOOKUP('Agent List'!C2, 'Agent List'!A:D, 4, FALSE)
As far as I know, I have met all the required arguments by stating where the data is stored by using 'Agent List'!, the look up value, the table array, which column to match it to, and whether I want an exact match or approximate match.
I have played around with the function for a while, and have looked at others posts, but was unable to resolve the issue on my own. Any help I can get with this would be great. Any suggestions on a better idea to achieve the same result are also welcome.
Thanks,
TNA
Agent List table example:
#N/A in a vlookup sense usually means the value was no found.
This is due the the data not being in the first column of reference.
Also are you trying to lookup the data from one sheet to another? The value you are looking up should be the first value in the formula. You appear to be looking up from the same table you are returning result from.
Instead you can try:
=VLOOKUP(OTHERSHEET C2, 'Agent List'!C:D, 2, FALSE)
OR
=INDEX('Agent List'!D:D,MATCH(C2,'Agent List'!C:C, 0),1)

Excel Power Pivot: Match next non-blank item after date match for customer across two tables using DAX

I need to create a calculated column in Table_Order that would find the next matching, non-blank Customer Status on or after the current Order Date for the current row Customer #.
The tricky part is when there is no matching Customer Status in Table_Ship for a Customer # on a particular Order Date (please see the orange highlights). The match then needs to be on the next matching Ship Date for the Customer # where the Customer Status is not blank.
Please could somebody help me and show me the DAX?
I've spent a long time Googling and have gotten nowhere. I feel like this should be easy!
Also please bear in mind that these tables are massively simplified versions of my actual work, and any suggestion to reorganise the tables or start from scratch won't help me, I need some DAX please!
Thanks in advance!
Phil.
I understand that you have large datasets, but I would recommend you create a FactCustomer table. Here there are the steps I followed with the data you provided.
Create a FactCustomer table
FactCustomer =
DISTINCT ( Table_Ship[Customer #] )
Create a relationship between Table_Ship and FactCustomer and Table_Order and FactCustomer, using Customer # as key.
Create a calculation in Table_Order to find customer status. The calculation makes a lookup (similar to VLOOKUP in excel) to find customer with the same date. This would retrieve the blank for Customer #3, so is neccesary to create a second calculation that would scan Table_Ship for the minimum date without blanks. The final step is using an IF statement to treat blank in the first function, when they are blank, the second formula is used.
Customer Status =
var find_customer = LOOKUPVALUE(Table_Ship[Customer Status],Table_Ship[Ship_Date],[Order Date],Table_Ship[Customer #],[Customer #])
var last_non_blank_date = CALCULATE(min(Table_Ship[Ship_Date]),Table_Ship[Customer Status]<>BLANK())
var find_non_blank = CALCULATE(min(Table_Ship[Customer Status]),filter(Table_Ship,Table_Ship[Ship_Date]=last_non_blank_date))
return if(ISBLANK(find_customer),find_non_blank,find_customer)
The result I get:

Partial match when look up value is lengthier than corresponding value in a table or a range

I have table as below. In first column name of the company and in next column corresponding country.
The look up value of company name is not exact match in this case
The company name from table is a subset of the look up value.
Reference Table as below:
The output expected is as follows:
I tried using formula=VLOOKUP(LEFT(B14,LEN(B14)-4),$H$2:$I$4,2,FALSE)
but it only help solve first entry and not for others. The output I got with above formula is as below:
Request help in sorting this issue.
Thanks
Maybe try the following:
=INDEX(I:I,SUMPRODUCT(ISNUMBER(FIND(H$3:H$4,B14))*ROW(H$3:H$4)))
However, this might be troublesome when you anticipate a word can be a sub-string inside another, eventually giving wrong results. If that won't be the case, that's great, but if so, then maybe safer would be:
=VLOOKUP(FILTERXML("<t><s>"&SUBSTITUTE(TEXTJOIN(" ",1,H$3:H$4,B14)," ","</s><s>")&"</s></t>","//s[preceding::*=.]"),H$2:I$4,2)

Define Status depending on Criteria

I have advanced Excel/Google Sheets skills. I have more of a conceptual question. I am happy with any solution (Excel or for Sheets, no difference for me).
I have a sheet where various coworkers have access and work with. It is used to define which product needs to go through which steps. Then when a part of a job is done, the status of the product is changed depending on criteria.
You can also think of it as projects and the status of a project.
The 3 examples shows how the data is input by the workers. Sometimes, the "No" cells are empty, sometimes they have a "No", sometimes for the same product, one criterion is empty, the other has a "No".
If I do a nested IF formula, I would have to create 32 of them (I believe, since its 5 criteria with each 2 options).
Obviously I can do that. I was wondering anyone has a better solution for me? Something more practical.
Thanks in advance!
Based on the data you've provided, it looks like your statuses are based on the number of Yes's in the input columns. Also you don't have a status shown for zero Yes's so I'll make an additional for that.
Given that assumption you can use a combination of the COUNTIF function (to count the Yes's), and the IFS function (to manage nested Ifs better) to drastically reduce the size of your function.
To make this cleaner I suggest you add a column and hide it containing: =COUNTIF([InputCriteria1to5Range],"Yes")
For the next formula assume the formula above is in B2. In your status column put the following:
=IFS(B2=5, Status1, B2=4, Status2, B2=3, Status3, B2=2, Status4, B2=1, Status5, B2=0, Status6)
Solution: Thanks to all for your help, I ended up firstly, creating ALL scenarios. This was actually the most complex part. See https://www.mrexcel.com/forum/excel-questions/654871-how-generate-all-possible-combinations-two-lists-without-macro.html (Answer from "Tusharm") where I had to repeat this process 5 times to have all possible outcomes. In the end, there were 192 combinations.
Then, I assigned a status for each combination.
Finally, for each product/row, I created another column where I concatenated the different criteria so that it looks exactly like my above combinations. Then finally index match the concatenated criteria to my combinations.

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.

Resources