Adapt IF AND ISBLANK formula combination in relation to UNIQUE FILTER on another sheet

djaida

Board Regular
Joined
Apr 27, 2022
Messages
59
Office Version
  1. 365
  2. 2019
  3. 2016
Platform
  1. Windows
Hello, my next question has to do with a formula in column QUOTE that will be checked by a UNIQUE FILTER formula and printed on a separate sheet. It currently checks if the two publishers have blank cells and prints the number 1 if they do, and 0 if they don't.

If possible, I would like to adapt the formula so that it also checks IF column TO ORDER =0, AND columns N:Q are blank (because the textbooks aren't from the two direct order publishers, and when there are no quantities there's no need for the suppliers to offer prices either) and prints 0; otherwise it should print 1 if there are entries in columns P:Q:

ORDER CALCULATIONS TEST.xlsx
ABCDEFGHIJKLMNOPQRSTUVWX
1 FOREIGN SUPPLIERS LOCAL SUPPLIERS fluff
2 DIRECT ORDER
3YearCodeTitleMinorLecturerTextbookAuthorPublisherISBNQuantityInstructorIn stockTO ORDERCENGAGEPEARSONSUPPLIER1SUPPLIER2QUOTESupplier FinalPrice FinalAvailabilityTrackingCOSTARRIVED #
41CS121Computer Organization and ArchitectureName SurnameComputer Organization and ArchitectureMcGraw-Hill51601 $ -$ -
51CS122Programming and Problem Solving IIName SurnameProgramming and Problem Solving IIPearson5106$ 50.000PEARSON$ 50.00$ 300.00
61CS123Discrete MathematicsName SurnameDiscrete MathematicsCENGAGE5106$ 60.000CENGAGE$ 60.00$ 360.00
71CS124Discrete MathematicsName SurnameDiscrete MathematicsCENGAGE5106$ 60.000CENGAGE$ 60.00$ 360.00
81CS124Discrete MathematicsName SurnameDiscrete MathematicsWiley5106$ 50.00$ 40.001SUPPLIER2$ 40.00$ 240.00
Listing
Cell Formulas
RangeFormula
J4:J8J4=IF(F4="No textbook",0,(COUNTIFS('ORDER CALCULATIONS MINOR COLUMNS.xlsx'!Table1[Major],"Computer Science",'ORDER CALCULATIONS MINOR COLUMNS.xlsx'!Table1[Minor],"-",'ORDER CALCULATIONS MINOR COLUMNS.xlsx'!Table1[Year],"1")))
K4:K8K4=IF(F4="No textbook",0,COUNTIF(E4,"<>"))
R4:R8R4=IF(AND(ISBLANK(N4), ISBLANK(O4)),1, 0)
S4:S8S4=IFERROR(FILTER($N$3:$Q$3, ($N4:$Q4 = T4) * ($N4:$Q4 <> "")), "")
T4:T8T4=IF(M4=0,0,MAX(N4:O4,MIN(P4:Q4)))
M4:M8M4=IF(J4+K4-L4<0,0,J4+K4-L4)
W4:W8W4=M4*T4
Named Ranges
NameRefers ToCells
direct_orders=Listing!$N$3:$O$3S4:S8
local_suppliers=Listing!$P$3:$Q$3S4:S8
Cells with Conditional Formatting
CellConditionCell FormatStop If True
P8:Q8Other TypeColor scaleNO
S1:S8Cell Valuecontains "SUPPLIER2"textNO
S1:S8Cell Valuecontains "SUPPLIER1"textNO
F2:F8,T1Cell Valuecontains "No textbook"textNO
P4:Q4Other TypeColor scaleNO
J4:J8,M4:M8,W4:W8Cell Value=0textNO
H4:H8,S4:S8Cell Valuecontains "CENGAGE"textNO
H4:H8,S4:S8Cell Valuecontains "PEARSON"textNO
A4:O6,P5:S6,A7:S7,A8:O8,R4:X8Expression=$U4="Available"textNO
A4:O4,A5:X7,R4:X4,A8:O8,R8:X8Expression=$F4:$F11=""textNO
A4:O4,A5:X7,R4:X4,A8:O8,R8:X8Expression=$U4="Temporarily unavailable"textNO
A4:O4,A5:X7,R4:X4,A8:O8,R8:X8Expression=$U4="Print on demand"textNO
A4:O4,A5:X7,R4:X4,A8:O8,R8:X8Expression=$U4="Out of print"textNO
A4:O4,A5:X7,R4:X4,A8:O8,R8:X8Expression=$V4="Ordered"textNO
A4:O4,A5:X7,R4:X4,A8:O8,R8:X8Expression=$V4="Arrived"textNO
A4:O4,A5:X7,R4:X4,A8:O8,R8:X8Expression=$V4="Incomplete"textNO
A4:O4,A5:X7,R4:X4,A8:O8,R8:X8Expression=$V4="Late"textNO


Then, I would like to adapt the UNIQUE FILTER formula on another sheet so that it only prints the textbooks that have quantities - so, to ignore zeroes.

ORDER CALCULATIONS TEST.xlsx
ABCDEFGHIJKLM
1YearCodeCourseMinorLecturerTextbookAuthorPublisherISBNQuantityInstructor copyIn stockTo order
21CS121Computer Organization and Architecture0Name SurnameComputer Organization and Architecture0McGraw-Hill05160
31CS124Discrete Mathematics0Name SurnameDiscrete Mathematics0Wiley05106
QUOTE
Cell Formulas
RangeFormula
A2:M3A2=UNIQUE(FILTER(Listing!A:M,Listing!R:R=1),FALSE,FALSE)
Dynamic array formulas.


I know I can convert the range to table in the second sheet and hide zeroes by filtering the table, but I would prefer to adapt the formula so that it never prints the books with 0 quantities in the first place. Can this be done and how?
 
I don't follow your point here:

That formula looks at values on the same row in columns R,S, and Q. The first two (R and S) are associated with the Direct Order publishers (incidentally, you mentioned these column contain "prices", but the table doesn't say anything about price...only a number...you might consider changing the column titles to say something about "Price"). The last variable in the equation is found in column Q, and represents a quantity needed to "Order", and that depends on columns N, O, and P. From what I can tell, none of these references look at the columns associated with the two local suppliers (columns T and U). Am I missing something?

Incidentally, this formula (if it really is supposed to look only at R,S, and Q) can be trimmed down to this:
Excel Formula:
=--AND(ISBLANK(R4:S4),Q4<>0)
...to deliver the same result. But I question whether this formula is what you really want. My understanding is that you want to proceed like this:
  1. For a variety of different textbooks shown in each row in column J, determine the number of additional copies of the textbook that should be ordered (column Q) based on the quantity of textbooks needed by students and instructor (sum of columns N and O) compared to the quantity of textbooks currently in stock (column P).
  2. For cases where the number of textbooks to Order (column Q) is >0, the Publisher (col. L) needs to be considered, as books from Cengage and Pearson need to be ordered exclusively and directly from those publishers. If this is true, then why would the Quote formula for a Pearson book require that the Price fields for both Cengage and Pearson be blank? Is it because you don't have a price from the relevant publisher yet...and that is why you are doing this step? I don't understand what you are trying to accomplish here. For a Pearson book, you would expect a price to be shown for Pearson (under col. S), but the formula used will automatically generate a 0 under the Quote column...is that intended? Are you using the Quote column to flag which rows have no price upon which to make a purchasing decision?
To me, it looks as if you want to determine the lowest price available for a book in column X (is that correct?). Are there ever any cases when either Cengage or Pearson offer prices on a book whose publisher is someone else (e.g. might McGraw-Hill hold publishing rights for a hardcover version of a book and Pearson offer the softcover version...in which case you might have prices for both?). Rather than make the low price determination dependent on whether Order<>0 (col. Q), have you considered using a filter to evaluate all prices available, regardless of what quantity is in the Order column, except make the formula more direct? By "more direct", I mean to explicitly require that Pearson books use the Pearson price, Cengage books use the Cengage price, and for any other publishers' books, the lowest offering from Supplier1 and Supplier2 is taken. This is reflected in a new formula in col. X.

Generally, I try to keep the foundational data together, organized in such a way to make it easy to sort, filter, extract, etc. If you do this, then anything that is derivative (such as subtotals by year, publisher, etc.) can be easily done with formulas, pivot tables, etc. elsewhere, but not in the foundational data set. Inserting those derivative rows directly into the data table is often done, it's intuitive and seems to make good sense, but doing so often causes problems with subsequent analysis. You may be able to extract the information you want using a formula that excludes those extra rows, provided those rows contain something in common (perhaps the words "yearly total"?) that would allow them to be filtered out.


You need to multiply all of the filtering conditional arrays together since they represent a logical AND condition. In other words, you want Publisher="CENGAGE" AND Quote<>0 (note this last expression is the opposite of what you tried...you want to consider entries where the Quote value is not 0, and exclude those entries where Quote=0), so...
(Listing!L:L="CENGAGE")*(Listing!V:V<>0), but I wouldn't recommend doing this as a full column operation. Instead, choose some reasonable size for your range references. A lot has been written about this practice...for example, see:




Once again, you are sending a confusing message. The Quote formula in column V appears to be intended for cases where you need pricing information from a vendor, and in those cases, the formula in col. V shows a 1 (and since the col. V formula returns only 0 or 1, the equivalent filter would either say Quote=1 or Quote<>0). In the small example below, I used Data Validation to create a cell (L12) that allows for the selection of either Cengage, Pearson, or Other. The Filter formula in J15 spill results from the main table to show the relevant entries that have a Quote (col. V) value of 1.
Book5 (version 1)_20231208.xlsx
JKLMNOPQRSTUVWXYZAAAB
1 FOREIGN SUPPLIERS LOCAL SUPPLIERS
2 DIRECT ORDER
3TextbookAuthorPublisherISBNQuantityAdditionalIn stockORDERCENGAGEPEARSONSUPPLIER1SUPPLIER2QUOTESupplier FinalPrice FinalAvailabilityTrackingCOSTARRIVED #
4Computer Organization and ArchitectureaMcGraw-Hill516050500SUPPLIER1, SUPPLIER2500
5Programming and Problem Solving IIbPearson510650500Pearson50300
6Programming and Problem Solving IIbPearson51061Pearsonno priceno price
7Discrete MathematicscCENGAGE510660500Cengage60360
8Discrete MathematicsdCENGAGE51061Cengageno priceno price
9Discrete MathematicseWiley51061 no priceno price
10
11
12Choose PUBLISHER at rightOther
13
14TextbookAuthorPublisherISBNQuantityAdditionalIn stockORDER
15Discrete MathematicseWiley05106
Listing
Cell Formulas
RangeFormula
V4:V9V4=--AND(ISBLANK(R4:S4),Q4<>0)
W4:W9W4=TEXTJOIN(", ",,IF(L4="Cengage","Cengage",IF(L4="Pearson","Pearson",FILTER($R$3:$U$3,R4:U4=X4,""))))
X4:X9X4=LET(p,IF(L4="Cengage",R4,IF(L4="Pearson",S4,MIN(FILTER(T4:U4,T4:U4>0,0)))),IF(p=0,"no price",p))
O5:O7,O9O5=IF(J5="No textbook",0,COUNTIF(I5,"<>"))
Q4:Q9Q4=MAX(0,N4+O4-P4)
AA4:AA9AA4=IFERROR(Q4*X4,"no price")
J15:Q15J15=FILTER(Listing!J4:Q10,IF(L12="Cengage",Listing!L4:L10="Cengage",IF(L12="Pearson",Listing!L4:L10="Pearson",((Listing!L4:L10<>"Cengage")+(Listing!L4:L10<>"Pearson"))=2))*(Listing!V4:V10<>0),"")
Dynamic array formulas.
Cells with Data Validation
CellAllowCriteria
L12ListCengage,Pearson,Other
Hi, I don't have my laptop with me tonight so detailed answers will have to wait until tomorrow.

I am doing the best I can with the knowledge I have. I have been given this task a long time ago and have had to dig around various resources to find even these formulas. As I'm the only one using this it makes sense to me, and yes, the numbers under the various publishers / suppliers columns are prices; I enter them as they arrive in offers we receive. No, there is never an occasion where Pearson might offer another publishers title; if a certain edition is published by Pearson, it's a Pearson title, Pearson is contacted for the price and their offer is recorded there.

As for comparisons, we compare the prices offered by the suppliers and the formula selects the cheaper price. Cengage and Pearson titles go on separate sheets and they get sent to each publisher; they send their prices in return, the prices are entered.

How can I explain so it makes sense to you? The purpose of the sheet is manifold: it organizes all courses per academic year, semester, department (those are the majors), minor, year, courses within those years, and common course + minor courses for years 3 and 4 for the departments which offer minors. A student can attend a minor from their department or other departments. I need to send a list of textbooks for those courses to publishers and suppliers and receive prices. Some prices are compared and lower ones chosen. The arrangements of the courses is supposed to show me how much will a student's package cost, and how much will all copies of a textbook cost, and what the cost will be per year per department, and the total cost of all copies from all departments. Reports need to be sent to management and once decisions are made packages will need to be prepared according to those list for all students of all years of all departments in that semester and academic year.

How can I do all this in the most efficient way? I've attended a beginner and a mid level Excel course, but nothing like this has ever been dealt with. My gut tells me this should be a database, but I can barely handle Excel. You mention pivot tables and what else; how do I utilize those to get what I need? I thought asking separate question and then combining the answer will give me a solution but I guess not?

Writing on my mobile is too cramped; I will have to wait for the rest tomorrow.
 
Upvote 0

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
Thanks for the explanation and clarifying a few questions that I had. Your workbook is intended to accomplish a lot of different tasks, so explaining the big picture with all of the desired outputs is important, as some of those desired outputs might influence how some of the smaller individual tasks should be done. If you are not familiar with the XL2BB add-in, you can get more details by clicking on the link in my signature block. Ideally, you will be able to install the add-in on your computer to facilitate sharing small working examples of your worksheet(s). One advantage to using XL2BB is that you can click on the clipboard icon in the upper left of the posted worksheet snippet, then navigate in your blank worksheet to the same cell shown in the upper left of the snippet, and paste. This reproduces the content and formulas posted in the snippet, and it allows you to quickly reproduce what is shown in these posts. When you have a chance, have a look at what I've posted above to see if it behaves as you expect...and let me know what is not behaving as expected. You can try out the publisher filter table shown in J14 and below, which depends on setting up a dropdown selection list in cell L12.
 
Upvote 0
Thanks for the explanation and clarifying a few questions that I had. Your workbook is intended to accomplish a lot of different tasks, so explaining the big picture with all of the desired outputs is important, as some of those desired outputs might influence how some of the smaller individual tasks should be done. If you are not familiar with the XL2BB add-in, you can get more details by clicking on the link in my signature block. Ideally, you will be able to install the add-in on your computer to facilitate sharing small working examples of your worksheet(s). One advantage to using XL2BB is that you can click on the clipboard icon in the upper left of the posted worksheet snippet, then navigate in your blank worksheet to the same cell shown in the upper left of the snippet, and paste. This reproduces the content and formulas posted in the snippet, and it allows you to quickly reproduce what is shown in these posts. When you have a chance, have a look at what I've posted above to see if it behaves as you expect...and let me know what is not behaving as expected. You can try out the publisher filter table shown in J14 and below, which depends on setting up a dropdown selection list in cell L12.
Your workbook is intended to accomplish a lot of different tasks
It is, and the order of the textbooks isn't random but depends on grouping those departments and years, so I don't really understand how filtering would help. I used to have an extra row below each year as well as the combination of y3 and 4 common courses and minors to get an accurate cost of those packages, e.g.

ORDERPRICES
FOREIGN SUPPLIERS LOCAL SUPPLIERS
ABCDEFGHIJKLMNOPQR DIRECT ORDERS
ProgrammeAca. YearMajorMinorYearSemesterCodeCourseLecturerTextbookTextbook purposeAuthorPublisherISBNQuantityAdditionalIn stockORDERCENGAGEPEARSONSUPPLIER1SUPPLIER2QUOTESupplier FinalPrice finalAvailabilityTrackingCOSTARRIVED #
Bachelor Degree Programme2023/24Computer Science012CS130Computer Organization and ArchitectureName SurnameISE Introduction to Computing Systems: From Bits & Gates to C/C++ & BeyondYale N. Patt, Sanjay PatelMcGraw-Hill9781260565911201021$ 40.00$ 50.001SUPPLIER1$ 40.00Pending$ 840.00
Bachelor Degree Programme2023/24Computer Science012CS160Programming and Problem Solving II 2-semester courseName SurnameIntroduction to programming with C++, 3rd International ed.Y. Daniel LiangPearson9780273793243201021$ 50.000$ 50.00Pending$ 1,050.00
Bachelor Degree Programme2023/24Computer Science012Math180Discrete MathematicsName SurnameDiscrete mathematicsRichard JohnsonbaughPearson9781292233703201165$ 50.000PEARSON$ 50.00Pending$ 250.00
$ 140.00$ 2,140.00
Bachelor Degree Programme2023/24Computer Science022CS240Database SystemsName SurnameDatabase Systems: Design, Implementation and ManagementMorris, S., Coronel, C.CENGAGE9781473768048231024$ 50.000CENGAGE$ 50.00Pending$ 1,200.00
Bachelor Degree Programme2023/24Computer Science022CS245Operating SystemsName SurnameSilberschatz's Operating System ConceptsAbraham Silberschatz, Peter B. Galvin, Greg GagneWiley9781119454083231024$ 50.00$ 40.001SUPPLIER2$ 40.00Pending$ 960.00
Bachelor Degree Programme2023/24Computer Science022CS260Cloud ComputingName SurnameCloud computing: concepts, technology & architectureErl, T., Puttini, R., & Mahmood, Z. Pearson9780133387520231024$ 50.000PEARSON$ 50.00Pending$ 1,200.00
Bachelor Degree Programme2023/24Computer Science022CS270Design and Implementation in Web EnvironmentsName SurnameSams Teach Yourself HTML, CSS & JavaScript Web Publishing in One Hour a DayLemay, Colburn & KyrninPearson9780672336232231024$ 50.000PEARSON$ 50.00Pending$ 1,200.00
Bachelor Degree Programme2023/24Computer Science022CS270Design and Implementation in Web EnvironmentsName SurnamePHP for the Web: Visual QuickStart GuideLarry UllmanPearson9780134291253231024$ 50.000PEARSON$ 50.00Pending$ 1,200.00
$ 240.00$ 5,760.00
Bachelor Degree Programme2023/24Computer Science032CS330Project managementName SurnameA guide to the Project Management Body of Knowledge (PMBOK guide)Project Management InstituteProject Management Institute9781628256642231024$ 40.00$ 50.001SUPPLIER1$ 40.00Pending$ 960.00
Bachelor Degree Programme2023/24Computer Science032CS360Business IntelligenceName SurnameAnalytics, Data Science, & Artificial Intelligence: Systems for Decision Support, Global ed.Ramesh Sharda, Dursun Delen, Efraim TurbanPearson9781292341552231177$ 50.000PEARSON$ 50.00Pending$ 350.00
Bachelor Degree Programme2023/24Computer Science032CS380Software EngineeringName SurnameSoftware EngineeringSommerville, IanPearson9781292096131231168$ 50.000PEARSON$ 50.00Pending$ 400.00
Bachelor Degree Programme2023/24Computer Science032LANG322EReports and Professional CorrespondenceName SurnameNo textbook0000$ 40.00$ 50.000$ -Pending$ -
Bachelor Degree Programme2023/24Computer ScienceElectrical and Electronic Engineering32Electrical Engineering$ 50.00$ 40.000$ -Pending$ -
$ 140.00$ 1,710.00
Bachelor Degree Programme2023/24Computer Science032CS330Project managementName SurnameA guide to the Project Management Body of Knowledge (PMBOK guide)Project Management InstituteProject Management Institute9781628256642231024$ 40.00$ 50.001SUPPLIER1$ 40.00Pending$ 960.00
Bachelor Degree Programme2023/24Computer Science032CS360Business IntelligenceName SurnameAnalytics, Data Science, & Artificial Intelligence: Systems for Decision Support, Global ed.Ramesh Sharda, Dursun Delen, Efraim TurbanPearson9781292341552231177$ 50.000PEARSON$ 50.00Pending$ 350.00
Bachelor Degree Programme2023/24Computer Science032CS380Software EngineeringName SurnameSoftware EngineeringSommerville, IanPearson9781292096131231168$ 50.000PEARSON$ 50.00Pending$ 400.00
Bachelor Degree Programme2023/24Computer Science032LANG322EReports and Professional CorrespondenceName SurnameNo textbook0000$ 40.00$ 50.000$ -Pending$ -
Bachelor Degree Programme2023/24Computer ScienceBusiness32EC360Marketing fundamentalsPrinciples of Marketing, European ed.Kotler, P.Pearson9781292269566140014$ 50.000PEARSON$ 50.00Pending$ 700.00
$ 190.00$ 2,410.00
Bachelor Degree Programme2023/24Computer Science032CS330Project managementName SurnameA guide to the Project Management Body of Knowledge (PMBOK guide)Project Management InstituteProject Management Institute9781628256642231024$ 40.00$ 50.001SUPPLIER1$ 40.00Pending$ 960.00
Bachelor Degree Programme2023/24Computer Science032CS360Business IntelligenceName SurnameAnalytics, Data Science, & Artificial Intelligence: Systems for Decision Support, Global ed.Ramesh Sharda, Dursun Delen, Efraim TurbanPearson9781292341552231177$ 50.000PEARSON$ 50.00Pending$ 350.00
Bachelor Degree Programme2023/24Computer Science032CS380Software EngineeringName SurnameSoftware EngineeringSommerville, IanPearson9781292096131231168$ 50.000PEARSON$ 50.00Pending$ 400.00
Bachelor Degree Programme2023/24Computer Science032LANG322EReports and Professional CorrespondenceName SurnameNo textbook0000$ 40.00$ 50.000$ -Pending$ -
Bachelor Degree Programme2023/24Computer ScienceEconomics32EC130Introduction to MacroecenomicsName SurnameMacroeconomicsDaron AcemogluPearson97812924121398109$ 50.000PEARSON$ 50.00Pending$ 450.00
$ 190.00$ 2,160.00
$ 14,180.00


so there was no possibility of sorting anything, but I am attempting to find a way for that information to be on a separate reports sheet, which is why those rows and repeating the common courses twice has now been removed. I've set that problem aside for now. I assume the report could be done with pivot tables but other than a couple of session on a mid-level Excel course I have no experience with them and wouldn't know how to set them up.

I'm trying to understand how your example will help me. I cannot have two suppliers in one celL as you do in W4; I don't think we ever had two suppliers give identical prices. Suppliers can never offer prices for C and P textbooks.

Choosing publisher at right only works for other - I understand it's because of the 1 in the QUOTE column, but I would need another listing for C, and another for P. That's why I have additional sheets for these two publishers.

What does this part of the formula mean; why the number 2?
Excel Formula:
(M5:M10<>"Cengage")+(M5:M10<>"Pearson"))=2)

And adding your mini table after tweaking a few things:

ORDER CALCULATIONS ANON 2023-12-14.xlsx
JKLMNOPQRSTUVWXYZAAABAC
1ORDERPRICES
2 FOREIGN SUPPLIERS LOCAL SUPPLIERS
3 DIRECT ORDER
4TextbookTextbook purposeAuthorPublisherISBNQuantityAdditionalIn stockORDERCENGAGEPEARSONSUPPLIER1SUPPLIER2QUOTESupplier FinalPrice FinalAvailabilityTrackingCOSTARRIVED #
5Computer Organization and ArchitectureMain textbookaMcGraw-Hill5106$ 50.00$ 50.001SUPPLIER1, SUPPLIER2$ 50.00$ 300.00
6Programming and Problem Solving IIMain textbookbPearson5106$ 50.000Pearson$ 50.00$ 300.00
7Programming and Problem Solving IIAdditional readingbPearson0101$ 50.000Pearson$ 50.00$ 50.00
8Discrete MathematicsMain textbookcCENGAGE5106$ 60.000Cengage$ 60.00$ 360.00
9Discrete MathematicsAdditional readingdCENGAGE0101$ 60.000Cengage$ 60.00$ 60.00
10Operating SystemsMain textbookeWiley5106$ 40.00$ 50.001SUPPLIER1$ 40.00$ 240.00
11
12
13Choose PUBLISHER at rightOther
14
15TextbookTextbook purposeAuthorPublisherISBNQuantityAdditionalIn stockORDER
16Computer Organization and ArchitectureMain textbookaMcGraw-Hill05106
17Operating SystemsMain textbookeWiley05106
Sheet1
Cell Formulas
RangeFormula
W5:W10W5=--AND(ISBLANK(S5:T5),R5<>0)
X5:X10X5=TEXTJOIN(", ",,IF(M5="Cengage","Cengage",IF(M5="Pearson","Pearson",FILTER($S$4:$V$4,S5:V5=Y5,""))))
Y5:Y10Y5=LET(p,IF(M5="Cengage",S5,IF(M5="Pearson",T5,MIN(FILTER(U5:V5,U5:V5>0,0)))),IF(p=0,"no price",p))
R5:R10R5=MAX(0,O5+P5-Q5)
AB5:AB10AB5=IFERROR(R5*Y5,"no price")
J16:R17J16=FILTER(J5:R10,IF(M13="Cengage",M5:M10="Cengage",IF(M13="Pearson",M5:M10="Pearson",((M5:M10<>"Cengage")+(M5:M10<>"Pearson"))=2))*(W5:W10<>0),"")
Dynamic array formulas.
Cells with Conditional Formatting
CellConditionCell FormatStop If True
U5:V5Other TypeColor scaleNO
U10:V10Other TypeColor scaleNO
Cells with Data Validation
CellAllowCriteria
M13List=$H$13:$H$15
 
Upvote 0
the order of the textbooks isn't random but depends on grouping those departments and years, so I don't really understand how filtering would help
Your comment about eliminating the blank rows makes sense. And because you would like to visualize the data grouped and sorted by departments, years, etc., it would make sense to me to combine all of the information in one large table (an official Excel table...with headings). Then you could add, delete, modify records (rows) to keep it up to date and apply a sorting scheme to it to meet your needs (probably using the native Custom Sort feature to sort my multiple columns in whichever order is needed). You could even use conditional formatting to alternate the fill shading of the groupings (that you currently use blank rows to differentiate). Whatever set of rules is used to create those groups (looks like it is based on Major, Year, and Semester)...those some grouping rules would be used in Conditional Formatting to create an easy-to-see grouping based on cell shading. If you add/delete/edit those records, the sorting scheme and conditional formatting should automatically adapt. But I wonder about how much information should be in this main table...
I cannot have two suppliers in one celL as you do in W4; I don't think we ever had two suppliers give identical prices. Suppliers can never offer prices for C and P textbooks.
Thanks for this clarification...I didn't know. As the formula is written, if only one supplier provides the lowest price, then only one supplier will be shown as the "Supplier Final. If two or more were to provide identical low prices, then they would all be shown in the Supplier Final. So if duplicate low prices never occur in reality, there is no harm in leaving the formula as you'll only ever see one supplier. But in the off chance that two suppliers do quote the same low price, you'll see that too. I'll have a look at the formula to address the "suppliers can never offer prices for C and P textbooks"...I wasn't sure whether C and P are "publishers" or suppliers of books.
Choosing publisher at right only works for other - I understand it's because of the 1 in the QUOTE column, but I would need another listing for C, and another for P. That's why I have additional sheets for these two publishers.
The point of the J14 table is mostly a proof-of-concept to do two things: 1) to confirm that the outputs are correct because I'm still not sure that I understand what you want, and 2) to generalize the formula so that a single formula would be capable of delivering all of the desired results. Rather than hardwiring "Pearson" in one formula, "Cengage" in another formula, and then writing a third formula that either explicitly names all other individual suppliers, or alternatively, excludes Pearson and Cengage is not really an ideal solution. I believe it is better to have one general formula that takes a single input: either Pearson or Cengage or Other...and the formula delivers the desired table. The benefit is that if you want to generate three different outputs, you could either use this single formula, select each of the three options and copy/paste the resulting outputs...OR...simply repeat this single formula three times and replace the dropdown selection (in L12 in the example) with the words Pearson for one table, Cengage for the second table, and Other for the third table.

I'm not sure what you mean by "only works for other". If you edit the working example so that some 1's appear in the Quote column for Cengage and Pearson, and you select Pearson or Cengage in L12, are you seeing the records that should be returned? This is what I mean by "proof-of-concept"...I'd like to confirm that the set of rules enforced by the formula are the correct ones.
What does this part of the formula mean; why the number 2?
Just above I mentioned that the formula needs a way to exclude Pearson and Cengage when you want to see the list of all textbooks that are not from those publishers. So the general formula applies the filter criteria in a series of steps: if the desired results involve Pearson (in cell L12) then require Publisher="Pearson", otherwise, if Cengage is in cell L12, then require Publisher="Cengage", otherwise we want to exclude both Pearson and Cengage. So if we have two arrays described as Publisher<>"Pearson" and Publisher<>"Cengage", we'll have two arrays consisting of TRUE's and FALSE's, and when we add these arrays together, the mathematical operation (addition in this case) coerces TRUE's to 1's and FALSE's to 0's. So the end result will be a single array consisting of n elements (TRUE + TRUE = 2, TRUE + FALSE = 1, FALSE + TRUE = 1, and FALSE + FALSE = 0), where n is the number of rows described by the original array (in my example the array depends on Listing!L4:L10...so there are 7 elements in the array). This resultant array will consist of two values: 1 where Publisher<>Pearson but Publisher=Cengage, 1 where Publisher<>Cengage but Publisher=Pearson, and 2 where Publisher<>Pearson and Publisher<>Cengage. So that is why "2" appears in the formula...it ensures that neither Pearson nor Cengage appear in the Publisher column for that record. Now that I look at it, a cleaner way to write the formula would change the two <> conditions to = conditions, then the 2 would become a 0, meaning that the resulting array would then consist of 0's and 1's, where 0's mean neither Pearson nor Cengage, and a 1 means that either Pearson or Cengage appear as the Publisher. Either way, this part of the formula performs the "exclude Pearson and Cengage" operation.

I'll need to think some more about your workbook. It might make better sense to use a series of tables to keep certain type of information organized while reducing redundancy. Earlier, you mentioned a database. This approach begins to resemble a relational database. For example...
  • One table would contain textbook-only information: title, author, ISBN, publisher, edition/yr...anything that uniquely identifies the textbook only.
  • Another table would contain course information: academic year, semester, course name, course number, and session numbers (unless all sessions will use the same textbooks)...anything that uniquely identifies the course
  • Another table relates each course/session to an instructor and required textbooks, recommended textbooks, no textbooks...and perhaps students.
Before going down this path, it would be good to understand what your raw data looks like. There might be more efficient ways to structure the workbook. I'm assuming you receive at least one type of report, and maybe multiple reports...and then you assemble the tables presented here? What does the content and structure of your starting data look like...Excel files, text files from a course registration system, etc.?
 
Upvote 0
Your comment about eliminating the blank rows makes sense. And because you would like to visualize the data grouped and sorted by departments, years, etc., it would make sense to me to combine all of the information in one large table (an official Excel table...with headings). Then you could add, delete, modify records (rows) to keep it up to date and apply a sorting scheme to it to meet your needs (probably using the native Custom Sort feature to sort my multiple columns in whichever order is needed). You could even use conditional formatting to alternate the fill shading of the groupings (that you currently use blank rows to differentiate). Whatever set of rules is used to create those groups (looks like it is based on Major, Year, and Semester)...those some grouping rules would be used in Conditional Formatting to create an easy-to-see grouping based on cell shading. If you add/delete/edit those records, the sorting scheme and conditional formatting should automatically adapt. But I wonder about how much information should be in this main table...
OK, that sound like a workable idea. As the number of departments and courses expand, I would need something that could grow with it, and keep track of year in and year out. The size of the table and the multiple purposes it has is what's been troubling me, and the whole reason why I am trying to find a better and hopefully simpler way to adapt it.

Thanks for this clarification...I didn't know. As the formula is written, if only one supplier provides the lowest price, then only one supplier will be shown as the "Supplier Final. If two or more were to provide identical low prices, then they would all be shown in the Supplier Final. So if duplicate low prices never occur in reality, there is no harm in leaving the formula as you'll only ever see one supplier. But in the off chance that two suppliers do quote the same low price, you'll see that too. I'll have a look at the formula to address the "suppliers can never offer prices for C and P textbooks"...I wasn't sure whether C and P are "publishers" or suppliers of books.
I would need to count how many books were offered by a given supplier, and what is the total cost of all books and their copies they offered. This way I can then compare the two, and say, ok so some of these books were cheaper with this supplier, but the overall total is lower with this supplier, so they will be chosen to supply them. Would each supplier in the cell be counted then? C and P are publishers, but since there is no intermediary - we order directly - they are also their own suppliers.

The point of the J14 table is mostly a proof-of-concept to do two things: 1) to confirm that the outputs are correct because I'm still not sure that I understand what you want, and 2) to generalize the formula so that a single formula would be capable of delivering all of the desired results. Rather than hardwiring "Pearson" in one formula, "Cengage" in another formula, and then writing a third formula that either explicitly names all other individual suppliers, or alternatively, excludes Pearson and Cengage is not really an ideal solution. I believe it is better to have one general formula that takes a single input: either Pearson or Cengage or Other...and the formula delivers the desired table. The benefit is that if you want to generate three different outputs, you could either use this single formula, select each of the three options and copy/paste the resulting outputs...OR...simply repeat this single formula three times and replace the dropdown selection (in L12 in the example) with the words Pearson for one table, Cengage for the second table, and Other for the third table.
One general formula is also what I want, because otherwise there's a chance that something will be missed.
I'm not sure what you mean by "only works for other". If you edit the working example so that some 1's appear in the Quote column for Cengage and Pearson, and you select Pearson or Cengage in L12, are you seeing the records that should be returned? This is what I mean by "proof-of-concept"...I'd like to confirm that the set of rules enforced by the formula are the correct ones.
OK, so the formula looks at the range J to R, as well as the M column (Publishers) repeated three times, and the column W (Quote) and the publisher selection in M13. When I write the publishers instead of Other, they don't get printed in the smaller table below, which - of course not, there's a 0 in column Quote. When I enter some 1s and then choose the publishers then yes, it changes. But I don't know how to edit the formula so that I get a listing for each of the publishers as well - I would prefer not to enter anything manually in that columns because the master table is several hundred rows long. I guess I'm not sure what you mean by repeating the formula three times? Could you please clarify?

I use
Excel Formula:
=UNIQUE(FILTER(Listing!A:R,Listing!M:M="CENGAGE"),FALSE,FALSE)
for CENGAGE,
Excel Formula:
=UNIQUE(FILTER(Listing!A:R,Listing!M:M="PEARSON"),FALSE,FALSE)
for Pearson, and
Excel Formula:
=UNIQUE(FILTER(Listing!A:R,Listing!W:W=1),FALSE,FALSE)
for Other.

Just above I mentioned that the formula needs a way to exclude Pearson and Cengage when you want to see the list of all textbooks that are not from those publishers. So the general formula applies the filter criteria in a series of steps: if the desired results involve Pearson (in cell L12) then require Publisher="Pearson", otherwise, if Cengage is in cell L12, then require Publisher="Cengage", otherwise we want to exclude both Pearson and Cengage. So if we have two arrays described as Publisher<>"Pearson" and Publisher<>"Cengage", we'll have two arrays consisting of TRUE's and FALSE's, and when we add these arrays together, the mathematical operation (addition in this case) coerces TRUE's to 1's and FALSE's to 0's. So the end result will be a single array consisting of n elements (TRUE + TRUE = 2, TRUE + FALSE = 1, FALSE + TRUE = 1, and FALSE + FALSE = 0), where n is the number of rows described by the original array (in my example the array depends on Listing!L4:L10...so there are 7 elements in the array). This resultant array will consist of two values: 1 where Publisher<>Pearson but Publisher=Cengage, 1 where Publisher<>Cengage but Publisher=Pearson, and 2 where Publisher<>Pearson and Publisher<>Cengage. So that is why "2" appears in the formula...it ensures that neither Pearson nor Cengage appear in the Publisher column for that record. Now that I look at it, a cleaner way to write the formula would change the two <> conditions to = conditions, then the 2 would become a 0, meaning that the resulting array would then consist of 0's and 1's, where 0's mean neither Pearson nor Cengage, and a 1 means that either Pearson or Cengage appear as the Publisher. Either way, this part of the formula performs the "exclude Pearson and Cengage" operation.
...that just went over my head :D I'll have to study it more when I have the spoons for it.

I'll need to think some more about your workbook.
So will I!

It might make better sense to use a series of tables to keep certain type of information organized while reducing redundancy. Earlier, you mentioned a database. This approach begins to resemble a relational database. For example...
  • One table would contain textbook-only information: title, author, ISBN, publisher, edition/yr...anything that uniquely identifies the textbook only.
  • Another table would contain course information: academic year, semester, course name, course number, and session numbers (unless all sessions will use the same textbooks)...anything that uniquely identifies the course
  • Another table relates each course/session to an instructor and required textbooks, recommended textbooks, no textbooks...and perhaps students.
Before going down this path, it would be good to understand what your raw data looks like. There might be more efficient ways to structure the workbook. I'm assuming you receive at least one type of report, and maybe multiple reports...and then you assemble the tables presented here? What does the content and structure of your starting data look like...Excel files, text files from a course registration system, etc.?
When it comes to raw data, I save the workbook to a folder for another year, delete all the prices as I'll be requesting new ones and keep the rest as courses and books rarely every change (e.g. new edition, book completely out of print so needs to be replaced by another, not necessarily from the same publisher - lecturer chooses what to use). Occasionally new courses will be added. As for students, I'll get an Excel list several months before each semester and count them by department/major, year, minor.
 
Upvote 0
I would need to count how many books were offered by a given supplier, and what is the total cost of all books and their copies they offered. This way I can then compare the two, and say, ok so some of these books were cheaper with this supplier, but the overall total is lower with this supplier, so they will be chosen to supply them. Would each supplier in the cell be counted then? C and P are publishers, but since there is no intermediary - we order directly - they are also their own suppliers.
Thanks for this clarification. The formula I posted does not do this. It looks only on the current row to automate the selection of book supplier based on the multi-part rule:

IF book Publisher=Cengage, then choose Cengage, ELSE IF Publisher=Pearson, then choose Pearson, ELSE choose Publisher (from either Supplier1 or Supplier2) whose price is lowest for that book based only on the price shown on that row

Your original formula that used MAX/MIN functions was doing something similar...looking only at that row. But if I understand correctly, you want to aggregate hypothetical total costs for Supplier1 (for all books and quantities), and do the same for Supplier2...and then decide which supplier should receive the bulk order for all books included in the comparison. Could you confirm that this is correct? This "winner take all" approach does not minimize your costs (the original find-minimal-price-offering-for-each-book would), but it could streamline the book acquisition process since you would not have to assemble two different sets of book titles/quantities to order from each supplier. You've already recognized this point when you say
ok so some of these books were cheaper with this supplier, but the overall total is lower with this supplier, so they will be chosen to supply them

But this raises a question that needs to be answered: For any book that is neither a Cengage nor a Pearson offering, will you always have a price for that book from both Supplier1 and Supplier2? This is important because when total costs are aggregated according to supplier--and the final selection of supplier depends on the lowest total cost--you'll need to ensure that the aggregation actually includes all books that are needed. Otherwise the aggregation of total costs needs to be done differently: Supplier1-only books, Supplier2-only books, and all other books offered by both Supplier1 and Supplier2.
But I don't know how to edit the formula so that I get a listing for each of the publishers as well - I would prefer not to enter anything manually in that columns because the master table is several hundred rows long. I guess I'm not sure what you mean by repeating the formula three times? Could you please clarify?
There seems to be some confusion about the summary formula. The formula is general in the sense that it reads the contents of only one cell (cell L12 where you can enter either "Cengage" or "Pearson" or "Other"), and that single cell reference directs the formula to return the sub-list of interest (any rows whose Publisher satisfies the L12 condition AND whose Quote column value is 1). So the formula itself--the formula proper--does not require any editing to make it return a sub-list for Cengage or Pearson or all other suppliers. Instead, it is the cell reference used by the formula (cell L12) that needs to change. So what I meant by "repeating the formula three times" is this...if you want to quickly toggle through the three different sub-lists, you could leave just one instance of the formula on a worksheet (like in J15) and use a dropdown list selector (like in L12) to change the sub-list report from Cengage to Pearson to Other simply by changing the L12 cell value. Alternatively, if you wanted three tables that stand alone, separate from each other, then the same formula is pasted three times, wherever you want, except you will need to think about that L12 cell value...that's what needs to change. What I posted is merely notional. Depending on where the sub-list would be placed and how you might label it, you might consider making the reference to L12 part of a top-level title like this...(note I selected and dragged the L12 dropdown to K12 to look better...and the formula automatically adjusted to point to this same K12 cell). Anyway, this is what I meant by using the same formula three times, except in each instance, the input cell needed by the formula would be different.
MrExcel_20231208_djaida.xlsx
JKLMNOPQ
12Sub-list for Quote=1 and Supplier:Pearson
13
14TextbookAuthorPublisherISBNQuantityAdditionalIn stockORDER
15Programming and Problem Solving IIbPearson05106
Listing
Cell Formulas
RangeFormula
J15:Q15J15=FILTER(Listing!J4:Q10,IF(K12="Cengage",Listing!L4:L10="Cengage",IF(K12="Pearson",Listing!L4:L10="Pearson",((Listing!L4:L10="Cengage")+(Listing!L4:L10="Pearson"))=0))*(Listing!V4:V10<>0),"")
Dynamic array formulas.
Cells with Data Validation
CellAllowCriteria
K12ListCengage,Pearson,Other
 
Upvote 0

Forum statistics

Threads
1,223,881
Messages
6,175,159
Members
452,615
Latest member
bogeys2birdies

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top