Filter/Take formula

erniepoe

Active Member
Joined
Oct 23, 2006
Messages
375
Office Version
  1. 365
Platform
  1. Windows
Hi All,

I have the following formula (provided to me earlier by a helpful member here), that works great. I had added the clause that I would only like to sum column P if column T contained "Professional Services," but unfortunately that doesnt end up with the correct result.

Any idea how I can update the formula so that it works correctly? Thanks so much.


=IFERROR(LET(f,FILTER('Bookings - Jan 2024'!$B:$P,('Bookings - Jan 2024'!$B:$B=O$6)+('Bookings - Jan 2024'!$B:$B="Subtotal")+('Bookings - Jan 2024'!$T:$T="*Professional Services*")),INDEX(TAKE(f,,-1),XMATCH(O$6,TAKE(f,,1))+1)),0)
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
+ is the equivalent of OR in your filter criteria so your results will include anything that matches at least one of the three criteria. To combine an OR on column B with AND on column T you need to multiply the col T filter:

Excel Formula:
=IFERROR(LET(f,FILTER('Bookings - Jan 2024'!$B:$P,(('Bookings - Jan 2024'!$B:$B=O$6)+('Bookings - Jan 2024'!$B:$B="Subtotal"))*('Bookings - Jan 2024'!$T:$T="*Professional Services*")),INDEX(TAKE(f,,-1),XMATCH(O$6,TAKE(f,,1))+1)),0)
 
Upvote 0
The reason for this is that there are numeric equivalents to TRUE and FALSE. Zero is FALSE, anything non-zero number is TRUE.
Doing math (on the spreadsheet, VBA is slightly different) on Boolean (TRUE/FALSE) expressions coerces them to 0 (FALSE) and 1 (TRUE).
So if you are adding values, if anyone is correct, it will be a non-zero number, thus TRUE. This makes it equivalent to OR (FALSE+TRUE=TRUE)
If you are multiplying values, multiplying by any FALSE (Zero) value will render the whole expression Zero, equating to FALSE. This makes it equivalent to AND (FALSE*TRUE=FALSE)
 
Upvote 0
so the above formula from Rory actually returns a 0 result. I tried changing the original range to include column T, as well as having an exact match on the professional services clause - ("SedonaOffice (Inside) - Professional Services Only") - but no dice.

Any ideas what might be the problem?
 
Upvote 0
I didn't look very closely at your conditions. Are you attempting to match where column T contains "Professional Services"? The = operator doesn't use wildcards so you are currently checking where column T is equal to the literal text "*Professional Services*" including asterisks. I suspect you want:

Excel Formula:
=IFERROR(LET(f,FILTER('Bookings - Jan 2024'!$B:$P,(('Bookings - Jan 2024'!$B:$B=O$6)+('Bookings - Jan 2024'!$B:$B="Subtotal"))*(ISNUMBER(SEARCH("Professional Services",'Bookings - Jan 2024'!$T:$T)))),INDEX(TAKE(f,,-1),XMATCH(O$6,TAKE(f,,1))+1)),0)
 
Upvote 0

Forum statistics

Threads
1,215,200
Messages
6,123,612
Members
449,109
Latest member
Sebas8956

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