Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel Formula Help 2

Status
Not open for further replies.

arvarr

MIS
Nov 24, 2009
260
AU
Seeking help around Excel formula.
I have 3 combinations - A,B & C that are number ranges.
I have broken them down into Lower and Upper.
Numbers that fall within Range A, Range B and Range C will give the expected Outcome.
Attached is an example workbook with subset of criteria.
Thanks,
Arv
 
 https://files.engineering.com/getfile.aspx?folder=a7bad3b5-8acc-4fda-b8f0-e2230eefedb8&file=Test_Book1.xlsx
Hi,

I've given you an approach that could be part or all of a solution: SUMPRODUCT.

But you may have some issues with your criteria table like...
1) 2 Outcome 16 rows
2) the criteria in Outcome 16 & the-would-be-Outcome 17 overlap!

Also your 4-line example has no valid Outcome 2

So, at this juncture, TILT!!!

Back to the drawing board.

Skip,

[glasses]Just traded in my OLD subtlety...
for a NUance![tongue]

"The most incomprehensible thing about the universe is that it is comprehensible" A. Einstein
 
Hi Skip
Yes, my bad with the table criteria.
Woohooo...Thanks for the formula.
Impressive as ever[2thumbsup]
Thanks,
Arv

 
It's ok, 2+3-1=4. Skip's formula works with either single or no match row entry.

IMHO such excel formulas, at least applied to the whole process, are hard to manage, esp. when you change assumptions. Moreover, you can't get more that single output easily. It is beter, from the point of robustness, to have some helper columns to process the data. Personally I would consider (if using excel) switching to power query environment (get & transform excel data section, built in excel since 2016 version). It is more natural and can give multiple match output, having both tables as input. In practice it is one of new BI applications implemented in excel, a powerful tool for data transforming, definitely worth to learn it.

combo
 
In the example you uploaded, you have ambiguous criteria. Which is the reason for your question.

Since this is a different question than the original, you ought to
1) delete the last 2 posts and
2) start a new thread.

If you want to allow multiple results, then a solution like combo suggested is possible, but then a simple "example" table with one slot is inadequate for reporting results. I would suggest a slightly different solution using MS Query. But that all should be in a new thread. Different question.

Skip,

[glasses]Just traded in my OLD subtlety...
for a NUance![tongue]

"The most incomprehensible thing about the universe is that it is comprehensible" A. Einstein
 
Hi combo
Are you able to provide example of the solution in power query so that i can refer to the data query setup?
Thanks,
arv
 
HI Skip
Sure, i will post in new thread.
Thanks,
arv
 
Continuing with the file you moved to new thread, I added a new sheet with Power Query solution. You need excel 2016 or higher.
To work with current data (Test_Book2), you need to enable connections if you are asked to.

The file contains:
1. criteria table with query to get the data in PQ environment (not necessary to work this way, but it profits in some situations, no need to name the query as source table),
2. input table with query to get the data in PQ,
3. query that processes input (queries) and criteria, with output to output table.

All you have to do is to fill input and criteria in tables and refresh output table (select any cell inside, right-click and refresh).
Don't change table names or headers unless you modify queries.

The single output query, line by its line:
1. appends criteria table to each input line,
2. expands criteria (so you have a product of tables),
3. tests A, B and C, combines tests,
4. filters final tests,
5. removes unnecessary input and helper columns.

combo
 
 https://files.engineering.com/getfile.aspx?folder=5215ba6a-a468-44ca-a3c7-568b0a6f3051&file=Test_Book2_PQ.xlsx
Hi combo
PQ > great feature to learn.
It looks like if input data does not fall into the table criteria, it omits the data in the output table.
Is there anyway to include and highlight those records?

Let me play around with the file and may come back with questions.

Thanks,
arv
 
As I wrote, the query creates table1 x table2 product and filters matching data. This is what I planned, to handle duplicated criteria matched.

To get all inputs, you could start new query from input data, add the query I created with external join (+expanding rows), remove unnecessary columns and replace Nulls (in output when no criteria match). For duplicated output you get multiple rows, you have to decide, how to handle this: you may leave the query as connection only (no worksheet output) and use it as input for pivot table (from external data source, you can find the query in workbook connections).

combo
 
Hi combo
Noted, let me give it a shot.
Thanks for your help [2thumbsup],
arv
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top