Learn how to a build a cloud-first strategyRegister Now

x
Solved

Sum a number of cells - testing for a non-number!

Posted on 2011-05-09
Medium Priority
280 Views
My fellow experts, is there a better way of performing the below?

=IF(BC8761="N/A",0,BC8761)+IF(BD8761="N/A",0,BD8761)+IF(BI8761="N/A",0,BI8761)+IF(BK8761="N/A",0,BK8761)+IF(BM8761="N/A",0,BM8761)+IF(BN8761="N/A",0,BN8761)+IF(BO8761="N/A",0,BO8761)+IF(BQ8761="N/A",0,BQ8761)

I feel sure that there must be, something perhaps using an array formula (which I am only just starting to use now).

thanks
Dave
0
Question by:Runrigger

LVL 85

Accepted Solution

Rory Archibald earned 2000 total points
ID: 35719282
If it's "N/A" rather than the #N/A! error, then:
=SUM(BC8761:BD8761,BI8761,BK8761,BM8761:BO8761,BQ8761)
0

LVL 11

Author Comment

ID: 35719318
Thanks Rory, I made an assumption;

=BC8761+BD8761+BI8761+BK8761+BM8761+BN8761+BO8761+BQ8761

doesn't work, so naturally (or perhaps unnaturally) thought that the sum would not work either, doh!!!

BTW it was "N/A"
0

LVL 50

Expert Comment

ID: 35719339
Hello,

If your cells were one contiguous range, you could use something like

=SUM(IF(ISNA(B2:Z2),0,B2:Z2))

entered with CTRL-SHIFT-ENTER as an array formula.

But the formula you cite above does not contain cells in a range. Rather, there seem to be gaps every two columns or so. You could change your formula by using the above array formula for the contiguous ranges and add them up, but that formula would even be longer.

What is in the cells that are not included in the formula? Could you treat the whole thing as one range?

=SUM(IF(ISNA(BC8761:BQ8761),0,BC8761:BQ8761)) <array entered!!>

Maybe you could post a data sample?

cheers, teylyn
0

LVL 6

Expert Comment

ID: 35719346
If you could arrange for your columns to be together you could use Sumif()

=SUMIF(BC8761:BQ8761,"<>N/A")
0

LVL 50

Expert Comment

ID: 35719348
Ok, I made the (wrong) #N/A error assumption.

Creds to rorya!
0

LVL 11

Author Closing Comment

ID: 35719363
Thanks Rory
0

LVL 11

Author Comment

ID: 35719444
Guys, my work email is playing up and I wasn't notified of your collective responses.

Teylyn, as always, a thoroughly complete response from you, thank you. Unfortunately, the people here have decided to mix and match column groupings in a template, which is widely distributed and can not be changed! Alas, I can not use a contiguous formula.

Similar response to TinTombStone, but I thank you both

The actual sheet is 140 columns wide and almost 30,000 rows deep, a positive behemoth

Regards
Dave
0

Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.
Suggested Courses
Course of the Month20 days, 18 hours left to enroll

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.