IFAND rule in excel - excel

I am trying to work in excel using IFAND rule to try and build the following logic however I am unsuccessful until now.
Department Date Customer
Digital 11/02/19 Customer A
Voice 14/02/19 Customer A
What I am trying to achieve is that, if customer A contacted us through a dept = digital and after voice it will return 1.
Can someone help please?
=if(and(A:A="Digital",B:B>b2,C:C=C2,A:A="Voice"),true,false)
This is the logic we have used so far.
Thanks!

Assuming data is sorted on Customer and Date, then try:
=AND(C2=C3,A2="Digital",A3="Voice")

Try Sumproduct,
=IF(A4="Voice",SUMPRODUCT(($B$3:$B$4>B4)*1,($C$3:$C$4=C4)*1,($A$3:$A$4="Digital")*1),0)
it allows you to assign a 1 for each row that meets the various criteria and then times all 3 criteria's resulting integers together
Criteria 1: Is column B greater than Date?
Criteria 2: Is column C = Customer
Criteria 3: Is column A = Voice
If all criteria are met for the row then
1x1x1 = 1
If any criteria arent met then the result is 0
0x1x0 = 0,
1x0x0 = 0,
0x0x0 = 0,
0x0x1 = 0,
etc, etc

Related

Countif on dynamic rows in Access

Hey I have a question for MS Access.
In Excel I would use the function =countif(A1:$A$2000; $B$3). So it only counts the ones in the same row and below.
How do I do that in MS Access? Something like count(iff([]))?
Cheers
Actually, there is an IIF function in ms-access. You can get the count if with a pipeline like:
SELECT Sum(IIf(id / 2 = id \ 2, 1, 0)) AS sum_of_even
FROM table;
In this case you obtain the sum of even ids. You can change the condition id / 2 = id \ 2 as you wish.
try this
counttotal: Count(IIf([credit]<20000,[credit],Null))
where credit is name of column, and you want to count the number of records where the value in the credit column is less than to 20,000

How to define an array of numbers with a formula

I have a project where I need to break people into 3 buckets with task lists that rotate quarterly (Phase A = task list 1, B = task list 2, C = task list 3). The goal here is to sort people into the buckets based on a departure date, with the ideal being that they would depart when they're in the C phase. I have a formula already set up that will tell me the number of quarters between the project start date and the person's departure date, so now I'm trying to figure out how to get Excel to tell me if a person's departure date falls within their bucket's C Phase.
I have this formula in a column called DEROSQtr:=ROUNDDOWN(DAYS360("1-Oct-2020",[#DEROS],FALSE)/90,0)
Now the easy way to approach this would be to build a static array and just see if that formula results in a value in the right array, where the numbers in the array define which quarter from Oct 2020 that the bucket's C Phase is going to be in:
ArrayA = {1;4;7;10;13;16} ArrayB = {2;5;8;11;14;17} ArrayC = {0;3;6;9;12;15}
The formula that pulls this all together is then:
=IF([#EFP]="A",IF(IFNA(MATCH([#DEROSQtr],ArrayA,0),-1)<>-1,TRUE,FALSE),IF([#EFP]="B",IF(IFNA(MATCH([#DEROSQtr],ArrayB,0),-1)<>-1,TRUE,FALSE),IF([#EFP]="C",IF(IFNA(MATCH([#DEROSQtr],ArrayC,0),-1)<>-1,TRUE,FALSE),"-")))
Now while this will work for as long as I build out the static array, I'm trying to figure out how to define each of these buckets with a formula that Excel can work with, i.e. bucket A hits phase C in 3n + 1 quarters where n is the number of cycles through all 3 phases, so ArrayA = 3n+1, ArrayB = 3n+2 and ArrayC = 3n. What I'm hunting for here is the best way to define each of the arrays as a formula.
After some additional digging and looking back at how to define each array, I came across the MOD() function in Excel. I was then able to rewrite the formula that does the checking as =IF([#EFP]="A",IF(MOD([#DEROSQtr]-1,3)=0,TRUE,FALSE),IF([#EFP]="B",IF(MOD([#DEROSQtr]-2,3)=0,TRUE,FALSE),IF([#EFP]="C",IF(MOD([#DEROSQtr],3)=0,TRUE,FALSE),"-"))), replacing ArrayA(3n+1) with MOD([#DEROSQtr]-1,3), ArrayB(3n+2) with MOD([#DEROSQtr]-2,3), and ArrayC(3n) with MOD([#DEROSQtr],3).
Since I do not have the data you are calculating your quarter, its difficult to give you exact answer. However, as I understand your have a column which has the formula to calculate the quarter say "Formula_Col"
Solution will be to add a new column and flag it based on the values in "Formula_Col".
If you can give some sample data I can provide exact answer.

Power BI first IF-Statement then the DAX-Formula

I am new to Power BI and have the following issue:
I tried to build a formula for a frequency counter. I got some examples from the web and I was able to build this working formula. The basic idea behind is to categorize an item with the values: daily, weekly or first time.
I tried to add an IF-Statement to the formula, that is checking a calculated column "Time frame", which shows the duration of an item in minutes.
Basically it should run this formula only if the Column "Time frame" is equal or bigger 1.
Now the formula gives to items with a Time frame of 0, the value first time. But they should be ignored or blanked.
Calculated column =
Var freqcount =
COUNTAX(FILTER(ALL('Count'),
AND([Date]>=DATEADD('Count'[Date],-6,DAY)&&[Date]<=EARLIER([Date]),[ID]=EARLIER('Count'[ID]))),ID])
return
if(freqcount>=4,"Daily",if(freqcount>=2,"Weekly",if(freqcount>=1,"First time","Inactive")))
I would be thankful, if someone could support me with this issue.
Edit: an ID can occur multiple times in my table but with different dates. But only once with the same date. For example:
ID 1, Date 01.01.2020
ID 1, Date 02.01.2020
ID 1, Date 03.01.2020
it is easier to use calculate:
Calculated column =
var rDate = yourTable[Date]
var rID = yourTable[ID]
var freqCount = CALCULATE(yourTable('Count'), FILTER(yourTable, rDate >= DATEADD(yourTable[Date], -6 , DAY) && rID = yourTable[ID] && yourTable['Time frame'] > 0))
return if(freqcount>=4,"Daily",if(freqcount>=2,"Weekly",if(freqcount>=1,"First time","Inactive")))
you see how I simply added the Time frame to the expression. Also I removed the use of earlier by using var's so it is better readable.

Index Match to return MAX Date with multiple criteria

apologies for this, I'm assuming this is simple but a few hours of SO googling hasn't helped
Enough whining from me:
Consider the following dataset:
ID, Date, Review, Review Status
1 01/02/18, "Cool", Positive
1 01/03/18, "Awesome", " Positive
1 01/01/18, "Cumbersome", Negative
1 01/02/18, "Rubbish!", " Negative
I'm currently using an array type index match to get the latest review based on a few conditions
I have two columns one which says positive, one negative.
in each of the column I would like to return the latest positive review but I'm unsure how to get the max date within the below formula:
{=index(C2:C4, MATCH(1,(1 = A2:A4)*("Positive" = D2:D4)*(maxdatehere = B2:B4),0))}
The data I have is around 7k rows and is Google Review Data and pretty much matches the example above.
I'd rather not use VBA as I've never really used it before (but will do so grudgingly)
as this is excel I've not created a google demo sheet, but happy to do so for ease of the experts and for others to benfit if they find there way here one day.
If you have Office 365:
=INDEX(C2:C5, MATCH(1,(1 = A2:A5)*("Positive" = D2:D5)*(MAXIFS(B:B,A:A,1,D:D,"Positive") = B2:B5),0))
Confirme with Ctrl-Shift-enter instead of Enter when exiting edit mode.
If you have 2010 or later then:
=INDEX(C:C,AGGREGATE(15,7,ROW(C2:C5)/((A2:A5=1)*(D2:D5="Positive")*(AGGREGATE(14,7,B2:B5/((A2:A5=1)*(D2:D5="Positive")),1)=B2:B5)),1))
Entered normally.

Should be simple in Zapier.... not for me

I need help with the following setup:
HubSpot (HS) form is filled out: name, email. zip code.
Zapier adds row to an existing Google Sheet 1 (GS1) with 4 columns: name, email, zip, department
Google Sheet 2 (GS2) has two columns : zip, department
Zapier needs to look up zip code in GS1. match zipcode in GS2, lookup department in GS2 and insert it into GS1 department
I need help with Number 4. As soon as I have that I can send info back to HubSpot and carry on with the flow I am making.
Can anyone help ?
Thanks in advance.
I think we may have a quicker solution at-hand, assuming you prefer one less Zap for the final step.
If you create a second Worksheet in GS1 to house your Zip+Department data, you can use a VLOOKUP to solve your data reconciliation challenge.
Set up your first Zap to copy only Name (Column A), Email(Column B), and ZIP (Column C).
Add your ZIP+Department data to a second sheet.
In column D, use this formula :
=VLOOKUP( C2, $RANGE_OF_ZIPCODES, 2, FALSE )
What this does...
C2 < This is the ZIP you want to look up for the current row.
[$RANGE_OF_ZIPCODES] < Replace this with either a Named Range of Cells
2 < If the ZIP from C2 is found, select the value from the SECOND column in the range
FALSE < Require an exact match of the ZIP value provided in C2
If the ZIP code is found, the matching department will be returned! If it's not found, you will see an error value in Column D.
Think this approach will work for you?
Assuming there are not too many zip code & department relationships, you could avoid steps 3 and 4 altogether and use Code by Zapier to look up the department in between steps 1 and 2. Then when you add the Google Sheets row in step 2 you will already know the department to insert.
Your "data out" for the Google Sheet in Zapier will then have access to department which will be a valid department string, or 'No Match!'
Example:
var hubspotZip = inputData.zip;
output = [];
var departments = {
"00001": "Department A",
"00002": "Department B",
"00003": "Department B",
"00004": "Department C"
};
if (departments.hasOwnProperty(hubspotZip)) {
var zipDepartment = departments[hubspotZip];
output.push({department: zipDepartment});
} else {
output.push({department: 'No Match!'});
}

Resources