The below nested if function works:

=IF(O4<5,IF(O4=1,IF(SUM(LEN(D4)-LEN(SUBSTITUTE(D4,"p","")))>1,K4/SUM(LEN(D4)-LEN(SUBSTITUTE(D4,"p","")))*L4/H4,L4/H4),G4*K4/H4),"N/A")

When I substitute the below if function in the "false" segment of the If len >1

IF(L4>0,L4/H4,"No YTD")

to get:

=IF(O4<5,IF(O4=1,IF(SUM(LEN(D4)-LEN(SUBSTITUTE(D4,"p","")))>1,K4/SUM(LEN(D4)-LEN(SUBSTITUTE(D4,"p","")))*L4/H4,IF(L4>0,L4/H4,"No YTD"),G4*K4/H4),"N/A")

I get the too many arguments error.

I've messed with it too long now and can't see the forest for the trees.

Any help appreciated.