cancel
Showing results for
Did you mean:
cancel
Showing results for
Did you mean:

SOLVED
Highlighted
Participant

## IF programming question

Hi all,

For the attached sheet, I am trying to calculate the mid-point of each layer using an if statement. The values are entered using an Excel table. For the first layer, the mid-point is simply H0/2 (so 0.9 m). For the second layer, the mid-point is the previous mid-point, plus the average of the previous and current points (so, 0.9 m + (1.8+1.6)/2 =  2.6 m). For some reason however, the simple IF code I am trying to use doesn't seem to work. I am not very familiar with programming in Mathcad, so any help would be appreciated.

Thanks!

-Fikret

1 ACCEPTED SOLUTION

Accepted Solutions

## Re: IF programming question

I guess this is what you're after.

Recreate the little program in your Prime, and it should work.

Success!
Luc

9 REPLIES 9

## Re: IF programming question

@ftatl63 wrote:

Hi all,

For the attached sheet, I am trying to calculate the mid-point of each layer using an if statement. The values are entered using an Excel table. For the first layer, the mid-point is simply H0/2 (so 0.9 m). For the second layer, the mid-point is the previous mid-point, plus the average of the previous and current points (so, 0.9 m + (1.8+1.6)/2 =  2.6 m). For some reason however, the simple IF code I am trying to use doesn't seem to work. I am not very familiar with programming in Mathcad, so any help would be appreciated.

Thanks!

-Fikret

Why isn't the midpoint of the second layer half the thickness of the second layer plus the whole first layer?

(1.8 + 1.6/2)

## Re: IF programming question

Both would return the same result, but the if statement still doesn't work because it appears the statement does not store the value for z0. Thanks.

## Re: IF programming question

I can't see Prime 5 files.  Can you attach a pdf file?

## Re: IF programming question

Who needs programming?

See attached version 4 file (readable in 5)

## Re: IF programming question

I guess this is what you're after.

Recreate the little program in your Prime, and it should work.

Success!
Luc

## Re: IF programming question

After I posted, I realized I am missing a for loop to step through the iterations :-) What you posted should work; thank you very much!

## Re: IF programming question

A range variable works like a for loop

## Re: IF programming question

A range variable works like a for loop.