I HAVE A SITUATION! Any help is greatly appreciated!

192 views
Skip to first unread message

K. Holdridge

unread,
May 16, 2022, 12:47:16 AM5/16/22
to Google Apps Script Community
In cell D1 in the PRODUCTS! spreadsheet it is working to get the CC'S amount from the PRICES! Spreadsheet 

What im trying to accomplish In cell C1 in PRODUCTS! is have a total amount of CC'S.
The B column in PRODUCTS! is the amount purchased of the code product in A column in PRODUCTS!

"HERE IS THE CODE THAT WORKS"
=SUMPRODUCT(IMPORTRANGE("1SFj5DBJXqqSnITsqH2rdIG-WpgR4KIwX9j8yon-4sDo","CC'S!B3:B"),IMPORTRANGE("1SFj5DBJXqqSnITsqH2rdIG-WpgR4KIwX9j8yon-4sDo","CC'S!A3:A")=A3)

HERE IS THE SAME FORMULA, JUST DIFFERENT AT THE END, THAT DOES NOT WORK.
=SUMPRODUCT(IMPORTRANGE("1SFj5DBJXqqSnITsqH2rdIG-WpgR4KIwX9j8yon-4sDo","CC'S!B3:B"),IMPORTRANGE("1SFj5DBJXqqSnITsqH2rdIG-WpgR4KIwX9j8yon-4sDo","CC'S!A3:A")=A3*B3,=A4*B4)

HERE IS THE PRICES SPREADSHEET

HERE IS THE PRODUCTS SHEET

Anybody know what im doing wrong?

Laurie Nason

unread,
May 16, 2022, 1:57:18 AM5/16/22
to google-apps-sc...@googlegroups.com
Hi Kyle - it looks like you have a problem with the formula in the products sheet - should that last = be in the formula?

--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/9c9b9709-03ba-4c0a-a1d2-92245409e8bdn%40googlegroups.com.

Clark Lind

unread,
May 16, 2022, 8:28:06 AM5/16/22
to Google Apps Script Community
In the end, what is it you want in the cell, the final sum? I don't know that sheets is smart enough..  you may have to just wrap it all in a sum(), or maybe try to use an arrayFormula() to solve it. 

You may be stuck summing each formula:
=sum(SUMPRODUCT(IMPORTRANGE("1SFj5DBJXqqSnITsqH2rdIG-WpgR4KIwX9j8yon-4sDo","CC'S!B3:B"),IMPORTRANGE("1SFj5DBJXqqSnITsqH2rdIG-WpgR4KIwX9j8yon-4sDo","CC'S!A3:A")=A3)*B3,
SUMPRODUCT(IMPORTRANGE("1SFj5DBJXqqSnITsqH2rdIG-WpgR4KIwX9j8yon-4sDo","CC'S!B3:B"),IMPORTRANGE("1SFj5DBJXqqSnITsqH2rdIG-WpgR4KIwX9j8yon-4sDo","CC'S!A3:A")=A4)*B4,
SUMPRODUCT(IMPORTRANGE("1SFj5DBJXqqSnITsqH2rdIG-WpgR4KIwX9j8yon-4sDo","CC'S!B3:B"),IMPORTRANGE("1SFj5DBJXqqSnITsqH2rdIG-WpgR4KIwX9j8yon-4sDo","CC'S!A3:A")=A5)*B5,
SUMPRODUCT(IMPORTRANGE("1SFj5DBJXqqSnITsqH2rdIG-WpgR4KIwX9j8yon-4sDo","CC'S!B3:B"),IMPORTRANGE("1SFj5DBJXqqSnITsqH2rdIG-WpgR4KIwX9j8yon-4sDo","CC'S!A3:A")=A6)*B6)
 etc etc 

Or see if this produces the result you want:
=ArrayFormula(SUMPRODUCT(IMPORTRANGE("1SFj5DBJXqqSnITsqH2rdIG-WpgR4KIwX9j8yon-4sDo","CC'S!B3:B"),IMPORTRANGE("1SFj5DBJXqqSnITsqH2rdIG-WpgR4KIwX9j8yon-4sDo","CC'S!A3:A")={A3:A})*{B3:B})

Reply all
Reply to author
Forward
0 new messages