Please improve this formula.

srizki

Well-known Member
Joined
Jan 14, 2003
Messages
1,860
Office Version
  1. 365
Platform
  1. Windows
I have this mega formula, but it is just repetitive of IFS. I want to see if it can be more efficient?

=IF(OR($A14="4 NET_ INCOME ',$A14="ECCS Net Income") ,SUMIFS(PGL!K:K,PGL!$E:$E,"NET
INCOME (Excl Non-Ctrl)"),IF($A14="4_ NET INCOME_ INCL NC" ,SUMIFS(PGL!K:K,PGL!$E:$E,"NET
INCOME (Incl Non-
Ctrl)"),IF($A14="4_NI BEF SUB INCL NC",SUMIFS(PGL!K:K,PGL!$E:$E,"INCOME BEFORE SUBS
(Incl Non-Ctrl)"),IF($A14="4_NI_ BEF _TAX SUB",SUMIFS(PGL!K:K,PGL!$E:$E,"INCOME BEFORE TAX
& SUBS (Incl Non-Ctrl)"),IF($A14="41 INTRST INC",SUMIFS(PGL!K:K,PGLI$E:$E, "INTEREST
INCOME") ),IF($A14="41 NET INTRST INC" ,SUMIFS(PGL!K:K,PGLI$E:$E,"NET INTEREST
INCOME"),IF($A14="42 INTEREST _EXP",SUMIFS(PGL!K:K,PGLI$E:$E. "INTEREST
EXPENSE"),IF($A14="44 LOAN LOSS PRV",SUMIFS(PGL!K:K,PGL!$E:$E,"LOAN LOSSES
PROV/(REVERSAL)") ),IF($A14="45 NII NON INTINC",SUMIFS(PGL!K:K,PGLI$E :$E "NON-INT
INCOME"),IF($A14="5 NON INTR EXP",SUMIFS(PGL!K:K,PGL!$E:$E, "NON-INTEREST
EXPENSE"),IF($A14="7 INCOME_ _TAX",SUMIFS(PGL!K:K,PGL!$E:$E "INCOME
TAX"),IF($A14="70 INCOME SUBS" ,SUMIFS(PGL!K:K,PGL!$E:$E, "INCOME FROM
SUBS"),IF($C14<>"" ,SUMIFS(PGL!K:K,PGL!$F:$E!Compare (Rollup)'!$C14),SUMPRODUCT(--
(CONCATENATE("%,N",$A14)=PGL!$A$17.$A$ 1000),PGL!K$17:K$ 1000)+SUMPRODUCT(--
(CONCATENATE("%,R," ,$A14)=PGL !.$A$17:$A$1000),PGL!K$17:K$ 1O0O))))))))))))))

Best Regards
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Please provide some data. 15 to 20 rows. Use XL2BB or a sharted link.
 
Upvote 0
I can not provide the data, it is on my work computer, but the formula says it all, =IF(SUMIFS, and SUMPRODUCT formula.
 
Upvote 0
You really need to help us help you. As shift-del mentioned your formula is invalid. Did you use an ink to text converter on it or something, the errors look like typo's but you can't possibly have typed that all in eg: PGL!K$17:K$ 1O0O (the letter O where it should be 0)

I suggest you start with throwing a lookup table into the mix to convert what you have in A14 into the value you need for the SumIfs column E evaluation.
That should reduce the whole formula to a single SumIfs and your catch all SumProduct formula at the end.
I would recommend making the mapping table an Excel Table to minimise future maintenance.

20240517 Nested If with Mapping Table srizki.xlsx
ABCDE
11Lookup Table to Convert A14 value to Data Table values
12
13Category to SumSumIfsA14 ValueFull Description
144_ NET INCOME_ INCL NC3,030ECCS Net IncomeNETINCOME (Excl Non-Ctrl)
154_ NET INCOME_ INCL NCNETINCOME (Incl Non-Ctrl)
164_NI BEF SUB INCL NCINCOME BEFORE SUBS(Incl Non-Ctrl)
174_NI_ BEF _TAX SUBINCOME BEFORE TAX& SUBS (Incl Non-Ctrl)
18
19
Main
Cell Formulas
RangeFormula
B14B14=SUMIFS(PGL!K:K,PGL!E:E,VLOOKUP($A14,$D$14:$E$17,2,FALSE))
 
Upvote 0
Hi Alex,
Thanks for providing me with the formula. I am using the following formula:
=F(C13<>"",SUMIF(PGL!F:F,'COMPARE (ROllup)'!C13,PGL!CC:CC),SUMIF(PGL!E:E,'COMPARE(ROLLUP)'!B13,PGL!CC:CC))
I just noticed that the lookup value is in column B, on sheet COMPARE (ROllup), but the range to match the value on sheet PGL could be in column A or Column E.
Please provide the formula,
 
Upvote 0
I need to see what your 2 sheets look like. If you use an image please include the row and column references.
An XL2BB of both would be useful or a sample of the workbook via Dropbox, Google Drive or some other sharing platform.
Also were is the formula going and what is the expected result
 
Upvote 0

Forum statistics

Threads
1,225,477
Messages
6,185,212
Members
453,283
Latest member
Shortm88

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top