mrGreenBrown
mrGreenBrown

Reputation: 596

Specific Excel function

I need to format some data in excel and I don't know how to write a very specific function and even worse, I don't know how to google it. The code in C-like programming language would be as the following:

if(x>1000)
   x = x/100+x%100;
else
   x = x;

I know the format of Excel formula, but something like this, certainly doesn't work:

=IF(A2>1000,A2/100+A2%100,A2)

Any help regarding this problem would be highly appreciated!

Upvotes: 1

Views: 53

Answers (2)

Klik Kliković
Klik Kliković

Reputation: 384

Do not use %.

Use MOD function instead.

How to: https://exceljet.net/excel-functions/excel-mod-function

Upvotes: 1

Sixthsense
Sixthsense

Reputation: 1975

Thanks for the clarification. Here is the excel formula.

=IF(A2>1000,INT(A2/100)+((A2/100)-INT(A2/100))*100,A2)

Upvotes: 0

Related Questions