Modify this array formula to correct #Num error

sunny17

New Member
Joined
Jul 6, 2011
Messages
8
I'm creating a worksheet using excel 2007. In column A I've calendar weeks from 1 to 52. In column F I'm using user form to select an entry from the list. Now in order to do some calculation in column J, I've written an array
formula. I'm trying to implement the following logic using this formula:

1st condition:
if the value in column A matches with the value of column A in previous row;
Condition passes....
Then check
if the value in Column F has occurred for the 1st time for similar value of column A
Condition passes....
Then, the value in Jx = ((20-Hx)/20)

2nd Condition:
if the value in column A is not equal to the value of column A in previous row;
Condition passes.....
Then , the value in Jx = ((20-Hx)/20)

Jx and Hx could be J2, H2 or J3, H3 etc. depending upon the calculation.

3rd Condition:
if the value in column A matches with the value of column A in previous row;
Condition passes....
Then check
if the value in column F has occured earlier for similar value of column A
Condition passes.....
Then, the value in Jx = Jy-(Ix*100)

Jy denotes the value of J where the Fx has occured last time.


This is the formula which goes in J5. But it throws #NUM error.

=IF(AND($A$2:$A4=A5,MATCH(F5,F:F,0)=ROW()),((20-H5)/20),INDEX(J$2:J4,SMALL(IF(F$2:F5=F5,ROW(F$2:F5)),COUNTIF(F$2:F5,F5)-1)-1,1)-I5)

 
Last edited by a moderator:

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
I've tried to reproduce your source data but to do so I have to make too many assumptions. I'll go with a general advice:

Have you tried to evaluate the formula to locate the cause of the error? Select J5 and go to Formulas > Formula Auditing > Evaluate Formula. The calculation step that produces your error for the first time is most probably the cause of your troubles.
 
Last edited by a moderator:
Upvote 0

Forum statistics

Threads
1,221,310
Messages
6,159,176
Members
451,543
Latest member
cesymcox

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