# Take a count of excel value and compare it with total value

Hi Team,

How to take a sum of monthly amount(of same pay period) and compare it with total amount and if total amount is not matching with sum of monthly amount then need to delete the row to make the sum of monthly amount and total amount equals of same pay period.

In this example…if we take 05/09/2023-08/12/2023 pay period and do sum of monthly amount…its equals to 1900, so here we need to delete the 5th & 7th row then it will be equals to total amount…How to implement this logic…Please advise.

Thanks & Regards,
Riya

Hi @Riya1,
The sum of monthly amount for the 05/09/2023-08/12/2023 is 2100, that is from cell B2:B7,
and may I know which you are referring as total amount in this table so that I would be able to help you out with the logic.

Good news, @Riya1

I was %90 done. Firstly it’s checked difference between b and c column sum.

Main.xaml (86.2 KB)
Data.xlsx (12.1 KB)

I’m still working on it.

In The example that you illustrated can’t I delete the 2 and 6 rows to achieve the sum of monthly = total amount?

Still working. It deletes line 12. Have you tried the code?

Dear, @Riya1

Finally, I done.

Data.xlsx (9.7 KB)
Main.xaml (153.3 KB)

I hope it was useful.

As per your requirement you need to code it this way:

1. Find the distinct Pay periods
2. Iterate each pay period
a) Filter the initial data table with currentItem
b) Find the difference in months in the current Payperiod
c) Check if FilteredData has rows equal to months+1 (from step b) if not
1a) Check if the total of all rows of column 2 (month amount ) is equal to any value of annual amount
2a) If not then see how much difference of rows and payperiod months and try to remove those many rows but keeping in mind the sum of row month should be equal to excess amount from annual amount.

summarizing what I have done

Guess so.

I was unable to view your main.xaml as I am using Studio not Studio X.

I just put out my solution in words

I also use studio

Change the .zip to .rar

1 Like

Thanks! Will check that.

@Riya1 Are you here. Please check the code.

Can you please share the dependency version as well?
I have tried your code but getting error as dependency version is different.Just FYI, I am using c# language.

Thanks,
RIya

Hello @Kismet_Tosun ,

I am not able to open mani.xaml file.Can youp lease share the zip file of it.

Thanks,
Riya

Welcome @Riya1 ,

Thanks @Kismet_Tosun ,
I am using below version:

It doesn’t matter, you can edit the process and use it. It works fine.

Can you please help me to convert the solution in version 2021.10.4 ? or can you share that sequence snapshot?

Regards,
Riya

You can uninstall the studio and install the current version. But you dont have to make this. I am publish the screen shot it will be help to you.

https://s6.dosya.tc/server21/3hj3nw/Uipat_ScreenShoot.rar.html

@Kismet_Tosun ,
I am not able to navigate to shared URL.Can you please paste the screenshot here?

Regards,
Riya