Google Sheets: SUMIF returns "Argument must be a range" error

Michelleaneous

New Member
Joined
Feb 16, 2024
Messages
13
Office Version
  1. 365
Platform
  1. Windows
The aim is to get the sum from another file based on a criteria from the "main" sheet. Importrange function was used to retrieve data from the other file (see formula below) but it will give an error message: "Argument must be a range"

Excel Formula:
=SUMIF(IMPORTRANGE("https://docs.google.com/spreadsheets/d/1iKwpbmnGuNBk7QJwi3m6RyKZXZ3fWexK/edit#gid=1466490795","Sheet1!A2:A"),B43,IMPORTRANGE("https://docs.google.com/spreadsheets/d/1iKwpbmnGuNBk7QJwi3m6RyKZXZ3fWexK/edit#gid=1466490795","Sheet1!E2:E))"))
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
this may not be relavant, as not sure of the importrange
BUT
you have
"Sheet1!A2:A"
so not a range
"Sheet1!A2:A10000"
is a range - is that why you have the error

"Argument must be a range"​

 
Upvote 0
this may not be relavant, as not sure of the importrange
BUT
you have
"Sheet1!A2:A"
so not a range
"Sheet1!A2:A10000"
is a range - is that why you have the error

"Argument must be a range"​

updated the range as suggested above but still get the same error
 
Upvote 0
IMPORTRANGE returns an array and SUMIF requires actual ranges on a sheet. You'd have to return the IMPORTRANGE results to a sheet and then refer to those cells in the SUMIF formulas.
 
Upvote 0
It seems that this formula doesn´t work when you retrieve the data from an external Google Sheets file, but I've tried this formula instead and it worked for me:

=SUM(FILTER(IMPORTRANGE($D$2, "C2. Pagos S10!$G$4:$G"), IMPORTRANGE($D$2, "C2. Pagos S10!$A$4:$A") = K$7))
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,177
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