#N/A! error due to complete column reference

lite4d

Board Regular
Joined
Jan 25, 2010
Messages
58
I using the below formula to count records in another sheet based on dates. I keep getting the #N/A! error because I am referencing the whole M:M column becuase more data will be added periodically. When I use a specific set of cells in M:M it works. Is ther a way around using specific cells?

=SUMPRODUCT((TEXT('CPJZ GI'!M:M,"mmm-yyyy")=TEXT(C2,"mmm-yyyy"))*('CPJZ GI'!E:E<=4))
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
Is there any reason you can't use SumIfs ? SumProduct is a terribly inefficient formula and will calculate the whole column.
A sumifs formula would look something like this:
Excel Formula:
=COUNTIFS('CPJZ GI'!M:M,">="&EOMONTH(C2,-1)+1,'CPJZ GI'!M:M,"<="&EOMONTH(C2,0),'CPJZ GI'!E:E,"<=" &4)
Easier to read if you add Line Feeds:
Excel Formula:
=COUNTIFS(
    'CPJZ GI'!M:M,">="&EOMONTH(C2,-1)+1,
    'CPJZ GI'!M:M,"<="&EOMONTH(C2,0),
    'CPJZ GI'!E:E,"<=" &4)

Please update your profile to show what version of Excel you are using as the solutions vary depending on the version.
Also the above probably doesn't need to use EOMonth twice but that depends on what value you have in C2.
 
Upvote 0
Why not simply select an arbitary cell reference, ie, M1:M10000..
 
Upvote 0
I can't select a specific number of rows because I have right now over 27K rows and more to be added periodically.
 
Upvote 0
Did you try the Countifs formula I had in post # 2 ?

PS: An alternative to setting a number of rows is to use an Excel Table and using Table references in your formula which would automatically include any new rows you added.
 
Upvote 0
Is there any reason you can't use SumIfs ? SumProduct is a terribly inefficient formula and will calculate the whole column.
A sumifs formula would look something like this:
Excel Formula:
=COUNTIFS('CPJZ GI'!M:M,">="&EOMONTH(C2,-1)+1,'CPJZ GI'!M:M,"<="&EOMONTH(C2,0),'CPJZ GI'!E:E,"<=" &4)
Easier to read if you add Line Feeds:
Excel Formula:
=COUNTIFS(
    'CPJZ GI'!M:M,">="&EOMONTH(C2,-1)+1,
    'CPJZ GI'!M:M,"<="&EOMONTH(C2,0),
    'CPJZ GI'!E:E,"<=" &4)

Please update your profile to show what version of Excel you are using as the solutions vary depending on the version.
Also the above probably doesn't need to use EOMonth twice but that depends on what value you have in C2.
Both of those show a zero. I have to match the date that is in C2(OCT-22) to the date in M:M(mm/dd/yyyy) and then find all of those records to determine witch of those have E:E<=4.
 
Upvote 0
Is C2 Text or a Date ? To test change the format to something else eg mm/dd/yyyy and if it doesn't change it is Text.
Do the same to Column M change to format to something different to what is displaying and tell me if it changes ?
Remember to hit Ctrl+Z to change it back each time.

Ideally show me an image of C2 which includes the Formula box and the cell in the image, then do the same for one of the cells in column M preferably using a Cell that has the Day value being > 12.
 
Upvote 0
Is C2 Text or a Date ? To test change the format to something else eg mm/dd/yyyy and if it doesn't change it is Text.
Do the same to Column M change to format to something different to what is displaying and tell me if it changes ?
Remember to hit Ctrl+Z to change it back each time.

Ideally show me an image of C2 which includes the Formula box and the cell in the image, then do the same for one of the cells in column M preferably using a Cell that has the Day value being > 12.
Holy crap.......i have working on this way to long today. when i changed it to the CORRECT cell(C3) it works! Thanks for the help anyways!
 
Upvote 0
Haha. That will do it ;).
It still worth considering using CountIfs. That group of functions takes UsedRange into account while SumProduct will multiply out the entire 1 million rows.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,179
Members
453,021
Latest member
Justyna P

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