Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
lrbest4x4xfar
 
Posts: n/a
Default count cell if value present in every other cell + criteria

I have a spreadsheet where I am trying to count the number of cells that have
a value in them. this is for counting raw material on either skids or metal
coils that is in inventory.

Here is what I am trying to do:

I am trying to count the two types of material that we have; 'Skids' and
'Coils'. The user selects either 'Skids' or 'Coils' from list in cell B2. In
cell C2, the header is '# MATL' and contains the formula I need help with.
On the same row, cell G2 is 'MATL_1_WT', which if the item is a 'Coil' the
user enters the weight. The next cell H2 is 'MATL_1_CT' which if the item is
a 'Skid' the user enters the amount of material on a skid. This continues
alternating throughout H3 thru Z2 so H3 is 'MATL_2_WT', I2 is 'MATL_2_CT', J2
is 'MATL_3_WT', K2 is 'MATL_3_CT' etc.

I want the formula to act like this: if cell B2 contains 'Coils', then I
want the formula to count cells G2, I2, K2, M2, O2, Q2, S2, U2, W2 and Y2 and
return the number of cells that contain data. If cell B2 contains 'Skids',
then I want the formula to count cells H2, J2, L2, N2, P2, R2, T2, V2, X2 and
Z2 and return the number of cells that contain data.

I thought the following formula would work, but it is invalid:
=COUNT(IF(C2="Coil",G2,I2,K2,M2,O2,Q2,S2,U2,W2,Y2) ,(IF(C2="Skid",H2,J2,L2,N2,P2,R2,T2,V2,X2,Z2))

I look forward to seeing if anyone can help me out!
  #2   Report Post  
Bob Phillips
 
Posts: n/a
Default

==IF(C2="Coil",COUNTA(G2,I2,K2,M2,O2,Q2,S2,U2,W2,Y 2),IF(C2="Skid",COUNTA(H2,
J2,L2,N2,P2,R2,T2,V2,X2,Z2),""))

or

=SUMPRODUCT(--(G2:Z2<""),--(MOD(COLUMN(G2:Z2),2)=(IF(C2="Coil",1,0))))

--
HTH

Bob Phillips

"lrbest4x4xfar" wrote in message
...
I have a spreadsheet where I am trying to count the number of cells that

have
a value in them. this is for counting raw material on either skids or

metal
coils that is in inventory.

Here is what I am trying to do:

I am trying to count the two types of material that we have; 'Skids' and
'Coils'. The user selects either 'Skids' or 'Coils' from list in cell B2.

In
cell C2, the header is '# MATL' and contains the formula I need help with.
On the same row, cell G2 is 'MATL_1_WT', which if the item is a 'Coil' the
user enters the weight. The next cell H2 is 'MATL_1_CT' which if the item

is
a 'Skid' the user enters the amount of material on a skid. This continues
alternating throughout H3 thru Z2 so H3 is 'MATL_2_WT', I2 is 'MATL_2_CT',

J2
is 'MATL_3_WT', K2 is 'MATL_3_CT' etc.

I want the formula to act like this: if cell B2 contains 'Coils', then I
want the formula to count cells G2, I2, K2, M2, O2, Q2, S2, U2, W2 and Y2

and
return the number of cells that contain data. If cell B2 contains

'Skids',
then I want the formula to count cells H2, J2, L2, N2, P2, R2, T2, V2, X2

and
Z2 and return the number of cells that contain data.

I thought the following formula would work, but it is invalid:

=COUNT(IF(C2="Coil",G2,I2,K2,M2,O2,Q2,S2,U2,W2,Y2) ,(IF(C2="Skid",H2,J2,L2,N2
,P2,R2,T2,V2,X2,Z2))

I look forward to seeing if anyone can help me out!



  #3   Report Post  
Aladin Akyurek
 
Posts: n/a
Default

=SUMPRODUCT(--(MOD(COLUMN(G2:Z2)-COLUMN(G2)+1-(B2="Coils"),2)=0),--(G2:Z2<""))

lrbest4x4xfar wrote:
I have a spreadsheet where I am trying to count the number of cells that have
a value in them. this is for counting raw material on either skids or metal
coils that is in inventory.

Here is what I am trying to do:

I am trying to count the two types of material that we have; 'Skids' and
'Coils'. The user selects either 'Skids' or 'Coils' from list in cell B2. In
cell C2, the header is '# MATL' and contains the formula I need help with.
On the same row, cell G2 is 'MATL_1_WT', which if the item is a 'Coil' the
user enters the weight. The next cell H2 is 'MATL_1_CT' which if the item is
a 'Skid' the user enters the amount of material on a skid. This continues
alternating throughout H3 thru Z2 so H3 is 'MATL_2_WT', I2 is 'MATL_2_CT', J2
is 'MATL_3_WT', K2 is 'MATL_3_CT' etc.

I want the formula to act like this: if cell B2 contains 'Coils', then I
want the formula to count cells G2, I2, K2, M2, O2, Q2, S2, U2, W2 and Y2 and
return the number of cells that contain data. If cell B2 contains 'Skids',
then I want the formula to count cells H2, J2, L2, N2, P2, R2, T2, V2, X2 and
Z2 and return the number of cells that contain data.

I thought the following formula would work, but it is invalid:
=COUNT(IF(C2="Coil",G2,I2,K2,M2,O2,Q2,S2,U2,W2,Y2) ,(IF(C2="Skid",H2,J2,L2,N2,P2,R2,T2,V2,X2,Z2))

I look forward to seeing if anyone can help me out!


--

[1] The SumProduct function should implicitly coerce the truth values to
their Excel numeric equivalents.
[2] The lookup functions should have an optional argument for the return
value, defaulting to #N/A in its absence.
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
copying cell names Al Excel Discussion (Misc queries) 12 August 11th 05 03:01 PM
Count number of values in a cell nyc_doc Excel Worksheet Functions 3 July 31st 05 12:34 AM
Cell color based upon cell value My View Excel Discussion (Misc queries) 11 July 6th 05 03:59 AM
cell color index comparison MINAL ZUNKE New Users to Excel 1 June 30th 05 07:11 AM
Show Blank is cell value=0 but count as a zero in sum. How to format this cell ? Markus Obermayer Excel Discussion (Misc queries) 1 January 4th 05 08:01 PM


All times are GMT +1. The time now is 02:47 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"