Forum Discussion
Jalil1985
Dec 28, 2021Copper Contributor
Reconciliation previous month salary with current month salary multiple columns
Hi, Dears, I am facing issue on reconciliation of salary between two months in power query. Following is a sample data of two months. *** Emp. ID. is unique ...
NowshadAhmed
Dec 28, 2021Iron Contributor
It was a little difficult to understand what you needed. If I am not wrong, then I think you want to show the difference in payment and where the difference occured? If yes, then all you need is a difference formula within an IF Statement. Something like:
IF(D10-D4>0,D10-D4,"") or IF(D10-D4>0,D10-D4,)
If you wanted to create separate columns when there is a difference, then you need macro for that. The macro will also need to consider cases when one employee doesn't show difference while 1 or more shows difference.
Alternately; in your place, I would use the IF Statement above for each column name and join them together using '&' function in one cell. This way I don't have to use macro. Something like this:
=IF(D10-D4<>0,"Utility: "&(D10-D4)&" - ",)&IF(E10-E4<>0,"Overtime: "&(E10-E4)&" - ")&IF(F10-F4<>0,"Conveyance: "&(F10-F4))
Using a structured or formatted table will make things easier.
IF(D10-D4>0,D10-D4,"") or IF(D10-D4>0,D10-D4,)
If you wanted to create separate columns when there is a difference, then you need macro for that. The macro will also need to consider cases when one employee doesn't show difference while 1 or more shows difference.
Alternately; in your place, I would use the IF Statement above for each column name and join them together using '&' function in one cell. This way I don't have to use macro. Something like this:
=IF(D10-D4<>0,"Utility: "&(D10-D4)&" - ",)&IF(E10-E4<>0,"Overtime: "&(E10-E4)&" - ")&IF(F10-F4<>0,"Conveyance: "&(F10-F4))
Using a structured or formatted table will make things easier.