Logic Function Question

ngero

New Member
Joined
Jul 1, 2019
Messages
2
Hi Everyone,

I have this formula that I use to pull a certain data while referencing certain cells.... Here is the formula:



{=IF(B419="","",IFERROR(INDEX('Work Orders'!N:N,MATCH(1,IF(VALUE(D419)='Work Orders'!AC:AC,IF("Canceled"<>'Work Orders'!K:K,IF('Work Orders'!AB:AB<=VALUE(B419),1))),0)),"No Work Order Type"))}

My issue is, it's pulling the mist match it sees and I need it to pull the closest date to B419... So lets say B419 is 06/20/2019 but the formula pulls a WO that is 05/01/2019 becuase it's the first one on the directory that has the same property code....

How can I insert a nested criteria that tells the formula to grab the most recent work order closet to B419(06/24/2019)?

Thank you!

-Nik
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Welcome to Mr Excel forum

Thoughts
1. For the sake of performance avoid references to entire columns in array formulas. Use the max number of expected (likely) rows in your actual scenario.
Something like
=IF(B419="","",INDEX("Work Orders'!N$2:N$1000, MATCH(1,IF(VALUE(D419)='Work Orders'!AC$2:AC$1000,....
1000 is arbitrary - adjust to fit with your real case

2. I would use a helper cell (say Z419) to get the most recent WO closest to B419 (06/24/2019)
Something like
Z419
=MAX(IF(VALUE(D419)='Work Orders'!AC$2:AC$1000,IF("Canceled"<>'Work Orders'!K$2:K$1000,IF('Work Orders'!AB$2:AB$1000<=VALUE(B419),'Work Orders'!AB$2:AB$1000))))
Ctrl+Shift+Enter

3. That said, the main formula would be
=IF(B419="","",IFERROR(INDEX('Work Orders'!N$2:N$1000,MATCH(1,IF(VALUE(D419)='Work Orders'!AC$2:AC$1000,IF("Canceled"<>'Work Orders'!K$2:K$1000,IF('Work Orders'!AB$2:AB$1000=Z419,1))),0)),"No Work Order Type"))
Ctrl+Shift+Enter

Hope this helps

M.
 
Last edited:
Upvote 0
Welcome to Mr Excel forum

Thoughts
1. For the sake of performance avoid references to entire columns in array formulas. Use the max number of expected (likely) rows in your actual scenario.
Something like
=IF(B419="","",INDEX("Work Orders'!N$2:N$1000, MATCH(1,IF(VALUE(D419)='Work Orders'!AC$2:AC$1000,....
1000 is arbitrary - adjust to fit with your real case

2. I would use a helper cell (say Z419) to get the most recent WO closest to B419 (06/24/2019)
Something like
Z419
=MAX(IF(VALUE(D419)='Work Orders'!AC$2:AC$1000,IF("Canceled"<>'Work Orders'!K$2:K$1000,IF('Work Orders'!AB$2:AB$1000<=VALUE(B419),'Work Orders'!AB$2:AB$1000))))
Ctrl+Shift+Enter

3. That said, the main formula would be
=IF(B419="","",IFERROR(INDEX('Work Orders'!N$2:N$1000,MATCH(1,IF(VALUE(D419)='Work Orders'!AC$2:AC$1000,IF("Canceled"<>'Work Orders'!K$2:K$1000,IF('Work Orders'!AB$2:AB$1000=Z419,1))),0)),"No Work Order Type"))
Ctrl+Shift+Enter

Hope this helps

M.


What do you mean by helper cell?
 
Upvote 0

Forum statistics

Threads
1,220,965
Messages
6,157,120
Members
451,399
Latest member
alchavar

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