Does anyone know how to fix this Excel UDF?

I have an excel UDF that is basically a series of if statements. The problem is that there can be multiple true statements and I want Excel to extract the "value if true" figure from the first if statement it finds true. However, right now, Excel is defaulting to the last if statement it sees as true (the last statement before End Function).

Any way to change this?

SB to the person that solves this!

3 Comments
 

Sending me the code (perhaps in a message) might help me gain a better intuition of the problem. But here's something.

  1. I imagine that you want your code to 'do something' if the first if-statement is true...just copy the part of the code which makes it 'do something' and paste in under that if-statement. Seeing your full code would help me figure out if this is viable.

Most coding languages have an exit/break command but I haven't found one for excel.

 

Nemo distinctio nostrum ea mollitia earum. Omnis perspiciatis sequi autem. Dolor quae impedit porro repudiandae molestiae harum occaecati. Quisquam officia sint et non aliquid optio. Quis est velit est dolorem animi dicta.

Incidunt sequi tempore placeat aut harum veniam. Ea deserunt perferendis consequatur ab et et. Quia excepturi praesentium ipsum quasi. Illum consequatur maiores laborum molestiae optio ut sequi.

Career Advancement Opportunities

August 2026 Investment Banking

  • Evercore 01 99.5%
  • Moelis & Company 01 98.9%
  • JPMorgan 01 98.4%
  • Morgan Stanley 08 97.8%
  • Goldman Sachs 02 97.3%

Overall Employee Satisfaction

August 2026 Investment Banking

  • Moelis & Company No 99.5%
  • Evercore No 98.9%
  • Morgan Stanley 01 98.4%
  • Banco Santander 02 97.8%
  • BMO Capital Markets 12 97.3%

Professional Growth Opportunities

August 2026 Investment Banking

  • Evercore 01 99.5%
  • Moelis & Company 01 98.9%
  • Morgan Stanley 06 98.4%
  • Goldman Sachs 01 97.8%
  • JPMorgan No 97.3%

Total Avg Compensation

August 2026 Investment Banking

  • Vice President (16) $429
  • Associates (50) $259
  • 3rd+ Year Analyst (8) $210
  • 2nd Year Analyst (25) $178
  • Intern/Summer Associate (14) $159
  • 1st Year Analyst (84) $151
  • Intern/Summer Analyst (75) $101
notes
16 IB Interviews Notes

“... there’s no excuse to not take advantage of the resources out there available to you. Best value for your $ are the...”

Leaderboard

1
redever's picture
redever
99.2
2
BankonBanking's picture
BankonBanking
99.0
3
kanon's picture
kanon
99.0
4
Secyh62's picture
Secyh62
99.0
5
dosk17's picture
dosk17
98.9
6
GameTheory's picture
GameTheory
98.9
7
CompBanker's picture
CompBanker
98.9
8
DrApeman's picture
DrApeman
98.9
9
Betsy Massar's picture
Betsy Massar
98.9
10
numi's picture
numi
98.8
success
From 10 rejections to 1 dream investment banking internship

“... I believe it was the single biggest reason why I ended up with an offer...”