Convert VLOOKUP to INDEX/COLLECT?
Hi, I am trying to calculate the fees for a project based a list of fees from another sheet. My current formula works when only one product is selected but does not work for multiple products. Would converting this to INDEX/COLLECT work? And if so, how would I do it?
Current formula looks up the value in Project Type/Scope on the Project Fees sheet and brings in the value from column 3. If the number of sites is >1 it adds the value from column 4, times the number of sites minus one
(VLOOKUP([Project Type/Scope]@row, {Project Fees}, 3, false)) + (IF([Number of Sites]@row > 1, ([Number of Sites]@row - 1), 0) * VLOOKUP([Project Type/Scope]@row, {Project Fees}, 4, false))
Columns being used - formula is in estimated fees column (ignore SOW#)
Project Type/Scope is a multi select dropdown
Project Fees sheet
Best Answer
-
Hi,
Yea I think you want to use COLLECT here to make this work.
For example:
=COLLECT({Fee Range}, {Lookup Range}, Contains(@cell, [Project Type/Scope]@row))
This will collect you all of the fees by comparing the selections in the multi drop down with the Lookup rows
You can SUM this to get the total fees for the first part of your equation.
=SUM(COLLECT({Fee Range}, {Lookup Range}, Contains(@cell, [Project Type/Scope]@row)))
You can follow the same pattern for the last part of your equation:
=SUM(COLLECT({Additional Fee Range}, {Lookup Range}, Contains(@cell, [Project Type/Scope]@row)))
Are the Additional Site Fees always the same?
Hope this helps!
SSFeatures
Nathan Braun (Founder of SSFeatures) (nathan@ssfeatures.com)
SSFeatures - The browser extension that adds more features into SmartSheet.
- Report PDF generator that supports grouped and summarized reports
- Automatic sorting, sorting with filters, saving sort settings
- Hiding and unhiding columns, and spell checking
Answers
-
Hi,
Yea I think you want to use COLLECT here to make this work.
For example:
=COLLECT({Fee Range}, {Lookup Range}, Contains(@cell, [Project Type/Scope]@row))
This will collect you all of the fees by comparing the selections in the multi drop down with the Lookup rows
You can SUM this to get the total fees for the first part of your equation.
=SUM(COLLECT({Fee Range}, {Lookup Range}, Contains(@cell, [Project Type/Scope]@row)))
You can follow the same pattern for the last part of your equation:
=SUM(COLLECT({Additional Fee Range}, {Lookup Range}, Contains(@cell, [Project Type/Scope]@row)))
Are the Additional Site Fees always the same?
Hope this helps!
SSFeatures
Nathan Braun (Founder of SSFeatures) (nathan@ssfeatures.com)
SSFeatures - The browser extension that adds more features into SmartSheet.
- Report PDF generator that supports grouped and summarized reports
- Automatic sorting, sorting with filters, saving sort settings
- Hiding and unhiding columns, and spell checking
-
thank you for this example! I created this formula but it is calculating zero for all rows
=SUM(COLLECT({Project Fees Range 2}, {Project Fees Range 3}, CONTAINS(@cell, [Project Type/Scope]@row)))
The Additional site fees differ depending on the product in the Project Type/Scope field.
-
Never mind! I figured out my error. Thank you!
-
You're welcome! Glad you got it working.
Nathan Braun (Founder of SSFeatures) (nathan@ssfeatures.com)
SSFeatures - The browser extension that adds more features into SmartSheet.
- Report PDF generator that supports grouped and summarized reports
- Automatic sorting, sorting with filters, saving sort settings
- Hiding and unhiding columns, and spell checking
Help Article Resources
Categories
- All Categories
- 14 Welcome to the Community
- Smartsheet Customer Resources
- 64.2K Get Help
- 419 Global Discussions
- 221 Industry Talk
- 461 Announcements
- 4.8K Ideas & Feature Requests
- 143 Brandfolder
- 143 Just for fun
- 58 Community Job Board
- 463 Show & Tell
- 32 Member Spotlight
- 1 SmartStories
- 300 Events
- 39 Webinars
- 7.3K Forum Archives
Check out the Formula Handbook template!