Return cell value if conditions met, without duplications

tlc53

Active Member
Joined
Jul 26, 2018
Messages
399
Hi,

I'm not sure how to use Match with an IF statement, or if it's even possible to do. Here is what I am hoping to achieve;

Car Type
B14:B23

Tax Treatment
E14:E23

Private %
F14:F23

Input Data
B28:B37

I would like the Input Data B28:B37 to be pre-populated depending on what the Tax Treatment and Private % are.

So if Tax Treatment = "Private Portion" AND Private % <.75 then populate Input Data with Car Type.

Eg. E14 = "Private Portion AND F14 <.75 then B28 = B14.

So all entries meeting this criteria will be shown in cells B28:B37 but with no duplications.

Hope I've explained that clearly enough! Thank you :)
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Don't see that you need MATCH, all ranges are ten rows, with each row of Input Data looking at a single row of other data. So in B28:

=IF(AND(E14="Private Portion",F14<0.75),B14,"")

Then copy down to the other rows in the Input Data range.
 
Upvote 0
Thank you, I did think of doing it that way. However, I don't want any empty rows.
So for example, if Row 1 and 4 meet the criteria, I want this to show in Rows 1 and 2 below, so there are no empty rows (ie. it's all descending).
Hope that makes sense.
 
Upvote 0
That's trickier. You could do it with a helper column to the left of Car Type (i.e. column A). You could put a formula in there that looked for a match on that row - if there was a match, add one to the value above, otherwise repeat the value above. This would then give a 1 on the first match, 2 on the second, and so on, which you could find with a VLOOKUP:

A14 formula (copy down to A23):
=IF(AND(E14="Private Portion",F14<0.75),1,0)+A13

B28 formula (copy down to B37):
=IFERROR(VLOOKUP(ROW(B28)-27,$A$14:$B$23,2,FALSE),"")

By deducting 27 from the row number, row 28 will find the first match (when column A becomes 1), row 29 will find the second match (when column A becomes 2) and so on. Assuming not all ten match, the VLOOKUP for the later rows will result in an error, which the IFERROR part if the formula will turn into a blank.
 
Upvote 0
Thanks Trevor.
There's more than one way to skin a cat and your formula (especially the second part) really helped me.
The problem with the first part was that it would add 0 if the one before did not meet the criteria, making the result 1 even if it was previously used. If I looked at summing all results above that would result in double counting (example below, no.5 would return 7, instead of 4).

1. Criteria met YES = 1
2. Criteria met YES = 2
3. Criteria met YES = 3
4. Criteria met NO = 0
5. Criteria met YES = 1

With a bit of working on the side, I was able to RANK them and then use your VLOOKUP formula. It now works exactly how I was hoping it to.
Thanks very much for all your help!! :)
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,219
Members
452,620
Latest member
dsubash

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