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.

 

Aliquid at beatae quisquam nobis et hic saepe. Molestias aliquam iusto architecto mollitia corporis tempora tenetur. Ipsa numquam enim voluptas eos. Sit voluptatibus exercitationem est adipisci.

Aut minus perferendis accusamus provident. Accusamus magni quaerat maiores aspernatur aliquid. Tempore perferendis molestiae eaque expedita cupiditate accusantium. Perferendis doloribus odit corporis voluptas suscipit. Doloremque architecto et temporibus velit aspernatur nesciunt nostrum. Voluptatibus iste atque dolorem minima qui molestiae.

Career Advancement Opportunities

July 2026 Investment Banking

  • Evercore 01 99.4%
  • Moelis & Company 01 98.9%
  • JPMorgan 01 98.3%
  • Guggenheim Partners 01 97.8%
  • Morgan Stanley 07 97.2%

Overall Employee Satisfaction

July 2026 Investment Banking

  • Moelis & Company No 99.4%
  • Evercore No 98.9%
  • Morgan Stanley 01 98.3%
  • Banco Santander 02 97.7%
  • BMO Capital Markets 12 97.2%

Professional Growth Opportunities

July 2026 Investment Banking

  • Evercore 01 99.4%
  • Moelis & Company 01 98.9%
  • Morgan Stanley 06 98.3%
  • Goldman Sachs 01 97.8%
  • JPMorgan 01 97.2%

Total Avg Compensation

July 2026 Investment Banking

  • Vice President (16) $429
  • Associates (46) $258
  • 3rd+ Year Analyst (8) $210
  • 2nd Year Analyst (22) $179
  • Intern/Summer Associate (14) $159
  • 1st Year Analyst (80) $150
  • Intern/Summer Analyst (73) $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...”