CHECK WITHIN FORMULA

PM1

Board Regular
Joined
Oct 28, 2005
Messages
192
In the formula below (which works fine) I want to add a condition.

Col H consists of letters P & C, when it finds a P it sums up the "C"'s until the next instance of P.

Now I want to add into the column 2 more letters K & A, so I want the formula to stop summing when it reaches these characters until the next instance of P.


IF(H2="P",IF(ISNUMBER(MATCH("P",H3:$H$3972,0)),SUM(L2:INDEX(L2:$L$3972,MATCH("P",H3:$H$3972,0))),SUM(L2:$L$3972)),"")/F2
Purch Orders BP²I.xls
FGHIJKL
261,266.00P2,217WindowsNTServers7,596.00
36157.00C WindowsNTServers942.00
4662.00C WindowsNTServers372.00
512174.00C WindowsNTServers2,088.00
66133.00C WindowsNTServers798.00
76169.00C WindowsNTServers1,014.00
8644.00C WindowsNTServers264.00
9635.00C WindowsNTServers210.00
10115.00C WindowsNTServers15.00
1116,365.00P13,555WindowsNTServers6,365.00
1222,641.00C WindowsNTServers5,282.00
132159.00C WindowsNTServers318.00
142230.00C WindowsNTServers460.00
15144.00C WindowsNTServers44.00
163235.00C WindowsNTServers705.00
171331.00C WindowsNTServers331.00
18135.00C WindowsNTServers35.00
19115.00C WindowsNTServers15.00
20138,960.64P38,961Networks38,960.64
Assets
 

Some videos you may like

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).

Domenic

MrExcel MVP
Joined
Mar 10, 2004
Messages
19,402
Is this what you mean?

=IF(H2="P",IF(ISNUMBER(MATCH(TRUE,INDEX(ISNUMBER(MATCH(H3:$H$3972,{"A","K","P"},0)),0),0)),SUM(L2:INDEX(L2:$L$3972,MATCH(TRUE,INDEX(ISNUMBER(MATCH(H3:$H$3972,{"A","K","P"},0)),0),0)))/F2,SUM(L2:$L$3972)/F2),"")
 

Watch MrExcel Video

Forum statistics

Threads
1,118,018
Messages
5,569,646
Members
412,285
Latest member
Daibear
Top