Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code is not pulling correct numbers on entry #3

Closed
delize opened this issue Oct 2, 2015 · 7 comments
Closed

Code is not pulling correct numbers on entry #3

delize opened this issue Oct 2, 2015 · 7 comments

Comments

@delize
Copy link

delize commented Oct 2, 2015

After coming across your code on stackoverflow, it looks like this is exactly what I need. I was pretty excited to try it out as it would help me simplify my spreadsheet

So I set it up, used the "getBackgroundColor" function with "" around the cell number, and it pulls the color code (in this case #ff0000 or #b7b7b7). However, when I use the "sumWhereBackgroundColorIs("#ff0000","B3:B500", "", "B3:B500")" it responds with 0 cells holding that color, even though I have in B3 that is being used by getBackgroundColor to let me know at hex code to check for.

I really do think this would do exactly what I am hoping for. I tried using the Google Scripts debugger, but it isn't incredibly helpful in this situation (as it expects there to be a range of something, and there isn't one).

@clupasq
Copy link
Owner

clupasq commented Oct 2, 2015

@delize Try removing the quotes around the last parameter:

=sumWhereBackgroundColorIs("#ff0000","B3:B500", "", B3:B500)

If it still doesn't work, perhaps you can share the document so I can take a look.

@delize
Copy link
Author

delize commented Oct 2, 2015

I get the following results (same issue, except now it displays #NUM) with the above string.

I unfortunately can't share this specific spreadsheet, but I can try to share a different spreadsheet where I get the same result. I have displayed pictures of the initial spreadsheet below. I know in the last picture it says #00ff00, as I was testing a green background instead of red for that "getbackgroundcolor"
2015-10-02_04-36-53
2015-10-02_04-37-10
2015-10-02_04-35-21
2015-10-02_04-35-55

Here is a spreadsheet where I receive the same issue.
https://docs.google.com/spreadsheets/d/1suirxEiZH9o7bkN1Pd9sVM5v0P-00vapVv6RrIoeUhQ/edit?usp=sharing

@clupasq
Copy link
Owner

clupasq commented Oct 2, 2015

For me, the doc you shared seems to work fine:

image

@delize
Copy link
Author

delize commented Oct 2, 2015

Unless I am mistaken, shouldn't the count be two? As the background color in cells B4 and C4 do not meet #ff0000 requirement?

@clupasq
Copy link
Owner

clupasq commented Oct 2, 2015

It's not a count; it's a sum. And if the sum encounters cells with non-numeric values it assumes them to be 0.

@delize
Copy link
Author

delize commented Oct 2, 2015

Yeah, I just realized that after re-reading the description again. Im mistaken. Thanks for your instant response time though. My bad.

@delize delize closed this as completed Oct 2, 2015
@clupasq
Copy link
Owner

clupasq commented Oct 2, 2015

Awesome! Glad this is solved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants