How can I calculate this Faster?

VBE313

Well-known Member
Joined
Mar 22, 2019
Messages
686
Office Version
  1. 365
Platform
  1. Windows
=IFERROR(IF(P4=1,SUM(O5:INDEX($P5:$P$2100,MATCH(TRUE,($P5:$P$2100=1),0)),-1),"")/R2,IF(P4=1,SUM(O5:INDEX($P5:$P$2100,MATCH(TRUE,($P5:$P$2100=1),0)),-1),"")/R2)

Would a UDF calculate this faster?
 
This:

=MATCH(TRUE,($P6:$P$2100=1),0)

is the same as this:

=MATCH(1,$P6:$P$2100,0)

it looks to me.

Well I've tried this and they give me different results.
=MATCH(1,$P6:$P$2100,0)
Returns 1 if the value 1 is held in P6, 2 if the value 1 is held in P7 and not P6, and so on.

I'm struggling to get the other formula to return anything other than #VALUE !
 
Upvote 0

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
The match true formula requires control shift enter not just enter. They will then produce the same result.
 
Upvote 0
Thanks Steve, OK I get that, but what's the point ?

=MATCH(1,$P6:$P$2100,0)
is easier to enter and edit.

On a related topic, I wonder if the original poster is still reading any of this ? :-)
 
Upvote 0
They both are doing exactly the same thing. Finding the relative position of 1 within the range. There are lots of ways to write the same thing in excel often just down to preference of the user.
 
Upvote 0
Hi Gerald, Yes I am still reading this haha. I need to find a way to make this not an array formula!
 
Upvote 0
If you use this version:

MATCH(1,$P6:$P$2100,0)

then the formula doesn't need to be an array formula.
 
Upvote 0

Forum statistics

Threads
1,223,894
Messages
6,175,250
Members
452,623
Latest member
Techenthusiast

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