I have a worksheet which contains a list of parameters 'Parameters':
A | B | C | D | E |
Manufacturer | Item Type | Price From | Price To | Percentage |
Apple | Mobile Phone | 0.00 | 99.99 | 50% |
Apple | Mobile Phone | 100.00 | 149.99 | 45% |
Apple | Tablet | 0.00 | 99.99 | 65% |
I have another worksheet which contains a list of retail items 'Retail Stock':
A | B | C | D |
Manufacturer | Item Type | Purchase Price | Retail Price |
Apple | Mobile Phone | 80.00 | ? |
Apple | Mobile Phone | 120.00 | ? |
Apple | Tablet | 95.00 | ? |
What I need to do in column D of 'Retail Stock' Worksheet, I need to pull back the relevant Percentage from the parameters worksheet in order to work out the Retail Price.
To find the percentage I need to do a lookup on Parameters worksheet, passing Manufacturer, Item Type and Purchase Price.
Please can someone advise on this,
I appreciate my question may need more padding to get the right answer, so if you need any more information, please ask.
You could use SUMIFS:
=SUMIFS(Parameters!E:E,Parameters!A:A,A2,Parameters!B:B,B2,Parameters!C:C,"<="&C2,Parameters!D:D,">="&C2)
I don't think there can be overlaps in prices as this wouldn't make much sense to me, so the above should give you the appropriate percentage.
Format as appropriate.
Note: If there is no match, then the function will return 0.
SUMIFS will take the sum from the column E of Parameters, provided that:
Column A is equal to A2,
Column B is equal to B2,
Column C is below C2,
Column D is above C2
here will only ever be one match, there will be no overlap in parameters
Try this one:
=SUMPRODUCT((Parameters!$A$2:$A$100=A2)*
(Parameters!$B$2:$B$100=B2)*
(C2>=Parameters!$C$2:$C$100)*
(C2<=Parameters!$D$2:$D$100)*
(Parameters!$E$2:$E$100)
)
for non matching rows formula returns 0
Related
I have an excel workbook where I am trying to count the number of apples in a named table. The workbook has multle sheets each named Jan, Feb, Mar, etc. with a corresponding table range of the same name.
My main worksheet has a list of months as columns and fruit as rows, I want to use a countif or suitable function to count the number of each fruit per month using the column heading as the worksheet portion of the formula.
This is what I have tried, this works, but has to be manually coded for each month, i would prefer it be more dynamic.
=COUNTIF(JAN[Labels],$A2)
Note: A2 contains the word apple
I have tried to get the month from the column date but it doesnt work
=COUNTIF(TEXT(E25,"mmm")[Labels],$A2)
This is roughly what the "master" table should look like (for clarity)
| | Jan-20 | Feb-20 | Mar-20 | .... |
| Apple | 4 | 3 | 5 | ... |
| Pear | 5 | 4 | 9 | ... |
EDIT:
Just to assist with anyone trying to help, this is roughly what a table on another sheet will look like:
| invoice | labels|
| 12535 | Apple |
| 12536 | Pear |
| 12537 | Apple |
This table would be a named table of Jan or Feb, etc.
Please try this:-
=COUNTIF(INDIRECT(TEXT(G2,"mmm")),"A")
G2 contains a proper date.
Here is a variation of the above where column 2 of the table is specified as the range to count in.
=COUNTIF(INDEX(INDIRECT(TEXT(G2,"mmm")),0,2),"B")
If you must use column captions to identify the column I would suggest MATCH to find it.
OK, so I found an answer, combining the above answer by Variatus with an additional new row.
| A | B | C | D |
1| | Jan-20 | Feb-20 | Mar-20 |
2| |JAN[Labels]|FEB[Labels]|MAR[Labels]| <- =UPPER(TEXT(B1,"MMM"))&"[Labels]"
3|Apple | 5 | 7 | 3 | <- =COUNTIF(INDIRECT(B$2),$A3)
4|Pear | 7 | 2 | 9 |
5|Orange| 1 | 3 | 3 |
So formula in B2 makes an uppercase text value of the month from B1 plus the column name Labels.
The formula in B3 (and down) counts the number of instances of the fruit from the named table & column shown in B2.
Within a resource planner, my data has a row for each employee, and columns detailing the team they work for. Another column details the available days they will work in the year. The teams are also displayed along a row at the top, see below :
A | B | C | D | E | F | G |
1 Employee | Team 1 | Team 2 | Days | Finance | Risk | IT |
2 Employee 1 | Finance | | 170 | | | |
3 Employee 2 | Risk | Finance | 170 | | | |
4 Employee 3 | Finance | | 170 | | | |
5 Employee 4 | IT | Risk | 170 | | | |
6 Employee 5 | IT | Finance | 170 | | | |
I want to use columns E:G as a supply calculator per team. Therefore, the formula in cell E2 would be "=IF(B2=E1,D2,0)" and copied along the row, returning the 170 days under Finance and 0 under the rest.
The issue lies where an employee divides his time between two different teams. As you can see, some employees can work for 2 different teams (Employee 2 works for both Finance and Risk, for example). The formula in E3 would therefore need to be some kind of IF AND, where if a value is present in the Team 2 column (C), the value in the Days column (D) would be divided by two and split across the relevent team columns.
I've tried a few options, IF AND, nested IFS etc but cant seem to get the syntax correct. Any help greatly appreciated.
=IF(ISNUMBER(MATCH(E$1,$B2:$C2,0)),$D2/COUNTA($B2:$C2),0)
You actually want OR and COUNTA:
=IF(OR($B2=E$1,$C2=E$1),$D2/COUNTA($B2:$C2),0)
I have sales data by customer as follows:
| - | A | B | C | D | E | F | G |
|---|---------------|--------|--------|--------|--------|--------|--------|
| 1 | Customer Name | Jan-18 | Feb-18 | Mar-18 | Apr-18 | May-18 | Jun-18 |
| 2 | Mr.A | 1000 | 500 | 0 | 200 | 0 | 0 |
| 3 | Mr.B | 0 | 300 | 200 | 0 | 0 | 100 |
I need the formula to know the last sales of the respective customer booked (the name of the month)
in this case, Mr. A last order is in Apr-18 while Mr.B is in Jun-18.
I have 2,000 plus customer and sales data since Apr 2016 up to last month, it will be a huge time saving to have a formula to help.
Assuming your 'months' are dates, not Text. Courtesy #barry houdini:
=LOOKUP(2,1/(B2:G2<>0),B$1:G$1)
in Row2 and copied down to suit, formatted mmm-yy.
Ref
An alternative to using LOOKUP() as in this answer, not sure what impact it has performance-wise as both need to create an array but I would take a stab in the dark that this is less performant:
=INDEX($B$1:$G$1,,MAX((B2:G2<>0)*COLUMN(B2:G2)-1)) - Ctrl+Shift+Enter
Ofcourse this could be edited to a dual lookup on the customer too:
=INDEX($B$1:$G$1,,MAX(INDEX(($B$2:$G$3<>0)*COLUMN($B$2:$G$3)-1,MATCH("Mr.B",$A$2:$A$3,0),0)))
This doesn't require the CSE as INDEX() handles the array manipulation
I have a list of customers, and a spreadsheet that tracks each encounter with them. A sample table looks like this:
Workbook 1: Table of customers
+------------+----------------+---------------------+
| Name | Current Status | Last Date Contacted |
+------------+----------------+---------------------+
| Customer A | Active | 3/1/2018 |
| Customer B | Inactive | 3/2/2018 |
| Customer C | Closed | 3/3/2018 |
+------------+----------------+---------------------+
Workbook 2: List of encounters
+------------+------------+----------+
| Name | Status | Date |
+------------+------------+----------+
| Customer A | New | 1/1/2018 |
| Customer A | Active | 2/1/2018 |
| Customer A | Active | 3/1/2018 |
| Customer B | New | 1/2/2018 |
| Customer B | Active | 2/2/2018 |
| Customer B | Disengaged | 3/2/2018 |
| Customer C | New | 1/3/2018 |
| Customer C | Active | 2/3/2018 |
| Customer C | Closed | 3/3/2018 |
+------------+------------+----------+
I have the following formula to return the last date contacted:
{=MAX(IF(Encounters[Name] = [#[Last Then First Name]], Encounters[Date])))}
I would like a formula that looks for the most recent date for each Customer, and return the status associated with that date. Is there a way to do this with formulas. Keep in mind that the formula would need to continue to work even if the worksheet were to be sorted. Thanks!
Assuming your table of customers is in Sheet1 (columns A to C) and your list of encounters is in Sheet2 (column A to C), and you already have your latest date of encounter per customer in column C of Sheet1, then you can enter the following formula in Sheet 1 cell B2 (then drag down to your last customer):
=INDEX(Sheet2!$B:$B,MATCH(1,(Sheet1!$A2=Sheet2!$A:$A)*(Sheet1!$C2=Sheet2!$C:$C),0))
This allows you to capture the latest status per customer. The formula would however be pretty taxing on the efficiency of Excel's calculation, so you can change the reference ranges to your structured table references. Please don't forget to return the formula using CONTROL+SHIFT+ENTER.
Use the following standard (non-CSE) formulas to gain the latest date and accompanying status per the supplied image.
'G2
=INDEX(B:B, AGGREGATE(15, 7, ROW(A:A)/((A$1:A$10=F2)*(C$1:C$10=H2)), 1))
'H2
=MAX(INDEX(C$2:C$10-(A$2:A$10<>F2)*1E+99, , ))
I am trying to use VLOOKUP-like functionality on a table that I have which unfortunately doesn't have the layout that is standard for VLOOKUP function.
Layout is as below:
Dealership 1 | Dealership 2 | Dealership 3
Make | Discount 1 | Website 1 | Discount 2 | Website 2 | Discount 3 | Website 3
Hyundai | 20% | www1 | 30% | www3 | 10% | www4
BMW | 10% | www1 | 15% | www3 | 3% | www4
Honda | 20% | www1 | 50% | www3 | 70% | www4
So Normally would I would do is VLOOKUP the whole array for rows that match the make I am looking for and output the discount I am looking for. However, I want to specify which Dealership I am getting the discount from as well.
You would use the MATCH as your third Criterion:
=VLOOKUP(I2,$A:$G,MATCH(J2,$1:$1,0),FALSE)
The MATCH() returns the column in which the Dealership is found. And uses that in the VLOOKUP to denote in which column the discount is found.
You can use the INDEX and MATCH combination to get a value in a 2D range
The formula I used here was
=INDEX($B$2:$G$4,MATCH($B$7,$A$2:$A$4,0),MATCH("Discount "&$B$8,$B$1:$G$1,0))