Alteryx Designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.

Re: Modulo (mod) Function: Not just for Evens and Odds

7 - Meteor

Hi 🙂


in order to check IBANs, I want to calculate the modulo 97 of very large numbers. In my example the number is 700901001234567890131400. Two websites independently say, that the result of 700901001234567890131400 modulo 97 is 90 (e.g. But when I calculate it with Alteryx the result is -79. The reason for this miscalculation seems to be, that the Formula-Tool can not handle numbers, that are as large as the first one. Does anyone have an idea how to work around that?




Thanks a lot in advance!

16 - Nebula

correction - you asked this question 3 months ago - and @Qiu made you a macro... as I said at the time -mod is an integer function and your number is larger than Int64. it will not work with mod on Alteryx... or excel.. there might be a python/r way.

17 - Castor

Wow, I did not recall until you brought it up. Thanks a lot.

Here is my reply.

I can anwser some queries from you after your review of the flow.

16 - Nebula

FYI here's the R way...

dat <- read.Alteryx("#1", mode="data.frame")
install.packages("VeryLargeIntegers", repos='http //')

VLIMOD <- data.frame(c("value"))
for (i in 1:nrow(dat)) {
x <- as.vli(as.character(dat$VLI[i]))
VLIMOD[i] <- as.numeric(summod(x,0,dat$Divisor[i])$value)}



this assumes:

1) you don't have VeryLargeIntegers  already installed and you can install packages in your R Tool

2) you MUST name your columns VLI (for the big number) and Divisor for the number you are dividing by.

3) you'll have to transpose the output because everything is in one row.

7 - Meteor

Hi @Qiu 


thanks a lot! Unfortunately I'm not at all familiar with macros in Alteryx. I will try to solve it with python now.


Thanks anyway.