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.

 

Quam repudiandae exercitationem voluptatum non inventore hic blanditiis voluptatum. Quod nihil possimus architecto aut ratione et numquam tempora. Suscipit qui est suscipit vel est praesentium consequuntur.

Atque cupiditate et quia nihil. Earum beatae vel excepturi cumque rerum suscipit. Odit ut id minima non.

Career Advancement Opportunities

October 2026 Investment Banking

  • Evercore 01 99.5%
  • Moelis & Company 01 99.0%
  • JPMorgan 01 98.4%
  • Guggenheim Partners 02 97.9%
  • Morgan Stanley 06 97.4%

Overall Employee Satisfaction

October 2026 Investment Banking

  • Moelis & Company No 99.5%
  • Morgan Stanley 02 99.0%
  • Evercore 01 98.4%
  • Banco Santander 02 97.9%
  • BMO Capital Markets 13 97.4%

Professional Growth Opportunities

October 2026 Investment Banking

  • Evercore 01 99.5%
  • Moelis & Company 01 99.0%
  • Morgan Stanley 05 98.4%
  • Goldman Sachs 01 97.9%
  • JPMorgan No 97.4%

Total Avg Compensation

October 2026 Investment Banking

  • Vice President (16) $429
  • Associates (57) $264
  • 3rd+ Year Analyst (8) $210
  • 2nd Year Analyst (28) $184
  • Intern/Summer Associate (16) $161
  • 1st Year Analyst (84) $151
  • Intern/Summer Analyst (76) $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

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...”