View Single Post
  #12   Report Post  
Aladin Akyurek
 
Posts: n/a
Default

COLUMNS(C5:L5)

returns the number of columns in C5:L5.

IF(COUNTIF(C5:L5,"x"),MATCH(2,1/(C5:L5="x")))

The condition part of IF consists of a conditional count. If the count
is zero (interpreted as FALSE), the IF bit as a whole will return FALSE
and the MATCH bit will be skipped. Thus when there is no x in C5:L5, we get:

10-FALSE == 10-0 == 10 (Math ops convert the truth values of TRUE and
FALSE into their numeric equivalents in Excel: 1 and 0, respectively.

When the COUNTIF bit (in the condition part of IF) returns a non-zero
count (a non-zero numeric result interpreted as TRUE), the MATCH bit is
evaluated.

The MATCH bit returns the position of the last x entry in C5:L5, which
is subtracted from the columns count. How does MATCH calculates the last
x's position is described he

http://tinyurl.com/7q6cd

Sam via OfficeKB.com wrote:
Hi Domenic,

If you have the time, could you explain the various parts of the Formula.
Much appreciated.

=COLUMNS(C5:L5)-IF(COUNTIF(C5:L5,"x"),MATCH(2,1/(C5:L5="x")))

needs to be confirmed with
CONTROL+SHIFT+ENTER.

Thanks
Sam