ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How do I choose to only add the first 3 numbers in a range? (https://www.excelbanter.com/excel-programming/309999-re-how-do-i-choose-only-add-first-3-numbers-range.html)

Tom Ogilvy

How do I choose to only add the first 3 numbers in a range?
 
=IF(SUM((CHOOSE(ROW(1:13),D3,G3,J3,M3,P3,S3,V3,Y3, AB3,AE3,AH3,AK3,AN3)*1<0)
*1)<3,"insuff.data",SUM(OFFSET(A3,0,SMALL(IF(CHOOS E(ROW(1:13),D3,G3,J3,M3,P3
,S3,V3,Y3,AB3,AE3,AH3,AK3,AN3)*1<0,ROW(1:13)),{1, 2,3})*3))/3)

Entered with Ctrl+Shift+Enter (since this is an array formula) seems to do
what you want.

--
Regards,
Tom Ogilvy


"frf" wrote in message
...
I have a range of numbers (non continuous) and i need to write a formula

to
only take the first three i encounter. I have written a formula which is

too
complex for excel to use so i need to come up with something new. Thanks

for
the help


Here is what i wrote:


=if(D3="",if(G3="",if(J3="",if(M3="",if(P3="",if(S 3="",if(V3="",if(Y3="",if(
AB3="",if(AE3="",if(AH3="",if(AK3="",if(AN3="","in suff.data",if(AQ3="","insu
ff.data",if(AT3="","insuff.data",(AT3+AQ3+AN3)/3))),if(AN3="",(AK3+AQ3+AT3)/
3,(AK3+AN3+AQ3)/3)),if(AK3="",(AH3+AN3+AQ3)/3,if(AN3="",(AH3+AK3+AQ3)/3,(AH3
+AK3+AN3)/3))),if(AH3="",(AE3+AK3+AN3)/3,if(AK3="",(AE3+AH3+AN3)/3,(AE3+AH3+
AK3)/3))),if(AE3="",(AB3+AH3+AK3)/3,if(AH3="",(AB3+AE3+AK3)/3,(AB3+AE3+AH3)/
3))),if(AB="",(Y3+AE3+AH3)/3,if(AE3="",(Y3+AB3+AH3)/3,(Y3+AB3+AE3)/3))),if(Y
3="",(V3+AB3+AE3)/3,if(AB3="",(V3+Y3+AE3)/3,(V3+Y3+AB3)/3))),if(V3="",(S3+Y3
+AB3)/3,if(Y3="",(S3+V3+AB3)/3,(S3+V3+Y3)/3))),if(S3="",(P3+V3+Y3)/3,if(V3="
",(P3+S3+Y3)/3,(P3+S3+V3)/3))),if(P3="",(M3+S3+V3)/3,if(S3="",(M3+P3+V3)/3,(
M3+P3+S3)/3))),if(M3="",(J3+P3+S3)/3,if(P3="",(J3+M3+S3)/3,(J3+M3+P3)/3))),i
f(J3="",(G3+M3+P3)/3,if(M3="",(G3+M3+P3)/3,(G3+J3+M3)/3))),if(G3="",(E3+J3+M
3)/3,if(J3="",(D3+G3+M3)/3,(D3+G3+J3)/3)))






All times are GMT +1. The time now is 09:33 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com