Expand my Community achievements bar.

# Adobe Campaign Classic v7 & Campaign v8

Announcing the launch of new sub-community for Campaign Web UI to cater specifically to the needs of Campaign Web UI users!
SOLVED

## How to use divide "/" function and between (50 to 100) in an if/else statement

Level 3

Hello,

In my list, there are two columns, Men and Women. Men value is '10', Women value is '5'.

I wan to convert following formula to use in an if else statement:

if (Men - Women) / Men == '50' to '100' then show this...

I am using following but its not working:

<% if (Number(targetData.Men) - Number(targetData.Women)) / Number(targetData.Men) =='50' to'100" )  { show this}

else { show this} %>

Any idea how to edit this statement to make it work?

Thanks!

1 Accepted Solution

Level 9

Hi @alik98709228 - you can try something like this:

``<% if ( ((Number(targetData.Men) - Number(targetData.Women)) / Number(targetData.Men)) >= 50 && ((Number(targetData.Men) - Number(targetData.Women)) / Number(targetData.Men)) <= 100 )  {...} else {...} %>``

Cheers

Darren

5 Replies

Level 9

Hi @alik98709228 - you can try something like this:

``<% if ( ((Number(targetData.Men) - Number(targetData.Women)) / Number(targetData.Men)) >= 50 && ((Number(targetData.Men) - Number(targetData.Women)) / Number(targetData.Men)) <= 100 )  {...} else {...} %>``

Cheers

Darren

Level 3

Hi Darren,

I tried but I am keep getting syntax error:

<% if ( ((Number(targetData.Men) - Number(targetData.Women)) / Number(targetData.Men)) >= 50 && ((Number(targetData.Men) - Number(targetData.Women)) / Number(targetData.Men)) <= 100 ) {...} else {...} %>

Do you think 50 and 100 should be within quotation marks like '50' and '100'?

And there should be "else if" not just "else"?

Let me know.

Thanks!