Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 46
Default Count column if heading exists

Hi, I have a report that calculates passed, failed, and N/A results. These
are also the titles of the columns. If one of these columns does not exist
then the calculations fail. I would like to know if there is a way to only
calculate these columns if they exist.
My current formula for the completed amount (adds failed, passed and N/A
totals) is

=(SUMPRODUCT(--(ISNUMBER(SEARCH("<total",$A$3:$A$40))),INDEX($A$ 3:$H$40,,MATCH("Failed",$A$3:$H$3,0)))+SUMPRODUCT(--(ISNUMBER(SEARCH("<total",$A$3:$A$40))),INDEX($A$ 3:$H$40,,MATCH("N/A",$A$3:$H$3,0)))+SUMPRODUCT(--(ISNUMBER(SEARCH("<total",$A$3:$A$40))),INDEX($A$ 3:$H$40,,MATCH("Passed",$A$3:$H$3,0))))/(SUMPRODUCT(--(ISNUMBER(SEARCH("<total",$A$3:$A$40))),INDEX($A$ 3:$H$40,,MATCH("<total",$A$3:$H$3,0))))

This formula needs all three columns to exist otherwise it returns a result
of #N/A
Is there a way to calculate only the columns that exist?

This one works
Test Failed Passed N/A <total
no 1 3 3 1 7
no 2 12 19 0 31
no 3 2 29 5 36


This one will fail because there is no results marked as Failed yet.
Test Passed N/A <total
no 1 3 1 4
no 2 19 0 19
no 3 29 5 34

Any help appreciated.
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 46
Default Count column if heading exists

Hi Don,
If the "failed" column does not exist then this formula returns N/A.
This then causes the remainder of the formula to return #N/A

=if(match("failed",a3:h3),formula,0)

Is there a way to make it ignore a portion of the formula if the result is
#N/A?

Thanks for your help.

"Don Guillett" wrote:

I'm a bit confused but something like this?
=if(match("failed",a3:h3),formula,0)

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Rusty" wrote in message
...
Hi, I have a report that calculates passed, failed, and N/A results. These
are also the titles of the columns. If one of these columns does not exist
then the calculations fail. I would like to know if there is a way to
only
calculate these columns if they exist.
My current formula for the completed amount (adds failed, passed and N/A
totals) is

=(SUMPRODUCT(--(ISNUMBER(SEARCH("<total",$A$3:$A$40))),INDEX($A$ 3:$H$40,,MATCH("Failed",$A$3:$H$3,0)))+SUMPRODUCT(--(ISNUMBER(SEARCH("<total",$A$3:$A$40))),INDEX($A$ 3:$H$40,,MATCH("N/A",$A$3:$H$3,0)))+SUMPRODUCT(--(ISNUMBER(SEARCH("<total",$A$3:$A$40))),INDEX($A$ 3:$H$40,,MATCH("Passed",$A$3:$H$3,0))))/(SUMPRODUCT(--(ISNUMBER(SEARCH("<total",$A$3:$A$40))),INDEX($A$ 3:$H$40,,MATCH("<total",$A$3:$H$3,0))))

This formula needs all three columns to exist otherwise it returns a
result
of #N/A
Is there a way to calculate only the columns that exist?

This one works
Test Failed Passed N/A <total
no 1 3 3 1 7
no 2 12 19 0 31
no 3 2 29 5 36


This one will fail because there is no results marked as Failed yet.
Test Passed N/A <total
no 1 3 1 4
no 2 19 0 19
no 3 29 5 34

Any help appreciated.



  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4,339
Default Count column if heading exists

If "Failed","Passed","N/A" are in columns B to D row 3 (but needn't be
present) then try:

=SUMPRODUCT(($A$4:$A$40="<total")*(($B$3={"Failed ","Passed","N/A"})*($B$4:$B$40)+($C$3={"Failed","Passed","N/A"})*($C$4:$C$40)+($D$3={"Failed","Passed","N/A"})*($D$4:$D$40)))

"Rusty" wrote:

Hi Don,
If the "failed" column does not exist then this formula returns N/A.
This then causes the remainder of the formula to return #N/A

=if(match("failed",a3:h3),formula,0)

Is there a way to make it ignore a portion of the formula if the result is
#N/A?

Thanks for your help.

"Don Guillett" wrote:

I'm a bit confused but something like this?
=if(match("failed",a3:h3),formula,0)

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Rusty" wrote in message
...
Hi, I have a report that calculates passed, failed, and N/A results. These
are also the titles of the columns. If one of these columns does not exist
then the calculations fail. I would like to know if there is a way to
only
calculate these columns if they exist.
My current formula for the completed amount (adds failed, passed and N/A
totals) is

=(SUMPRODUCT(--(ISNUMBER(SEARCH("<total",$A$3:$A$40))),INDEX($A$ 3:$H$40,,MATCH("Failed",$A$3:$H$3,0)))+SUMPRODUCT(--(ISNUMBER(SEARCH("<total",$A$3:$A$40))),INDEX($A$ 3:$H$40,,MATCH("N/A",$A$3:$H$3,0)))+SUMPRODUCT(--(ISNUMBER(SEARCH("<total",$A$3:$A$40))),INDEX($A$ 3:$H$40,,MATCH("Passed",$A$3:$H$3,0))))/(SUMPRODUCT(--(ISNUMBER(SEARCH("<total",$A$3:$A$40))),INDEX($A$ 3:$H$40,,MATCH("<total",$A$3:$H$3,0))))

This formula needs all three columns to exist otherwise it returns a
result
of #N/A
Is there a way to calculate only the columns that exist?

This one works
Test Failed Passed N/A <total
no 1 3 3 1 7
no 2 12 19 0 31
no 3 2 29 5 36


This one will fail because there is no results marked as Failed yet.
Test Passed N/A <total
no 1 3 1 4
no 2 19 0 19
no 3 29 5 34

Any help appreciated.



  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 46
Default Count column if heading exists

Thank you very much Toppers. That works great.
Thanks Don for your help as well.


"Toppers" wrote:

If "Failed","Passed","N/A" are in columns B to D row 3 (but needn't be
present) then try:

=SUMPRODUCT(($A$4:$A$40="<total")*(($B$3={"Failed ","Passed","N/A"})*($B$4:$B$40)+($C$3={"Failed","Passed","N/A"})*($C$4:$C$40)+($D$3={"Failed","Passed","N/A"})*($D$4:$D$40)))

"Rusty" wrote:

Hi Don,
If the "failed" column does not exist then this formula returns N/A.
This then causes the remainder of the formula to return #N/A

=if(match("failed",a3:h3),formula,0)

Is there a way to make it ignore a portion of the formula if the result is
#N/A?

Thanks for your help.

"Don Guillett" wrote:

I'm a bit confused but something like this?
=if(match("failed",a3:h3),formula,0)

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Rusty" wrote in message
...
Hi, I have a report that calculates passed, failed, and N/A results. These
are also the titles of the columns. If one of these columns does not exist
then the calculations fail. I would like to know if there is a way to
only
calculate these columns if they exist.
My current formula for the completed amount (adds failed, passed and N/A
totals) is

=(SUMPRODUCT(--(ISNUMBER(SEARCH("<total",$A$3:$A$40))),INDEX($A$ 3:$H$40,,MATCH("Failed",$A$3:$H$3,0)))+SUMPRODUCT(--(ISNUMBER(SEARCH("<total",$A$3:$A$40))),INDEX($A$ 3:$H$40,,MATCH("N/A",$A$3:$H$3,0)))+SUMPRODUCT(--(ISNUMBER(SEARCH("<total",$A$3:$A$40))),INDEX($A$ 3:$H$40,,MATCH("Passed",$A$3:$H$3,0))))/(SUMPRODUCT(--(ISNUMBER(SEARCH("<total",$A$3:$A$40))),INDEX($A$ 3:$H$40,,MATCH("<total",$A$3:$H$3,0))))

This formula needs all three columns to exist otherwise it returns a
result
of #N/A
Is there a way to calculate only the columns that exist?

This one works
Test Failed Passed N/A <total
no 1 3 3 1 7
no 2 12 19 0 31
no 3 2 29 5 36


This one will fail because there is no results marked as Failed yet.
Test Passed N/A <total
no 1 3 1 4
no 2 19 0 19
no 3 29 5 34

Any help appreciated.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Count data in one column if certain criteria exists in another. Carol Excel Worksheet Functions 14 April 27th 07 03:27 PM
Determining if a value already exists in column(s) Rookie_User Excel Discussion (Misc queries) 0 October 3rd 06 05:32 PM
In a table produce an value by column heading and row heading naflan Excel Worksheet Functions 1 December 27th 05 05:18 PM
Determine if Value in column A exists in Column B TJKarakowski Excel Discussion (Misc queries) 3 July 19th 05 06:27 PM
Find if value in column A exists in Column B Bzzer Excel Worksheet Functions 1 January 13th 05 02:41 AM


All times are GMT +1. The time now is 07:11 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"