# Nested IF Function based on text condition

1. ## Nested IF Function based on text condition

All morning I have been in Excel trying to create a function that will give me the full Currency name based on its acronym.

For example, Column "X" contains various different currency codes (INR, CAD, USD, HKD, ect.)
I am trying to draft a function where based on the prefix of that cell, the full currency name should populate.

But since there are various currency codes, I need to put various conditions.

So I tried, =IF(X1="ARS","Argentine Peso", OR(X1="CAD",X1="USD",X1="INR",X1="COP",X1="GHS")) - This didn't work, shows false for everything not ARS.

Then I tried to nest the if functions..
=IF(X1="ARS", "Argentine Peso", IF(X1="CAD", "Canadian Dollar", IF(X1="ARS", "Argentine Peso"))) - It keeps saying too many arguments. Nothing I try works!

As humbly as I can ask... pls help

2. ## Re: Nested IF Function based on text condition

Hi curious formula seeker and welcome to the forum.

This is a job for VLookup(,,,False) to do exact matches. In the first column you need to have the TLA, like ARS, CAD,.. etc
In the second column needs to be the full name like Argentine Peso, Canadian Dollar,.. etc.

Then look up the TLA using a VLookup and it will return the full words.

3. ## Re: Nested IF Function based on text condition

Build up a small table somewhere with the first column made up of the acronyms and the second column made up of the appropriate currency name, and then you could use the VLOOKUP function, something like this:

=IFERROR(VLOOKUP(X1,table,2,0),"")

where table contains the cell references for where your table occurs.

Hope this helps.

Pete

4. ## Re: Nested IF Function based on text condition

Hi maybe try this:

=IFERROR(INDEX(\$C\$2:\$C\$254,MATCH(\$X\$2,\$D\$2:\$D\$254,0)),"")

5. ## Re: Nested IF Function based on text condition

You guys have been such a big help. Both VLOOKUP and the formula billgyrotech1 posted worked. Just curious if there really is no actual way to nest the function in a conditional statement?

6. ## Re: Nested IF Function based on text condition

if you are asking is there a way to work it with a nested if function there is. Your second attempt in post #1 is close.
for one thing, your third argument is a repeat of the first AND you didn't add the "else if" part which I added after the third argument. So that would be a way to work a nested if statement though if you have many of these it is more efficient to use the vlookups or index/matches proposed by others.

7. ## Re: Nested IF Function based on text condition

SamboKid..

You are a genius, the formula worked.

TYSM!!!

This is the final Formula guys..

=IF(X2="ARS", "Argentine Peso", IF(X2="CAD", "Canadian Dollar", IF(X2="USD", "US Dollar", IF(X2="INR", "Indian Rupee", IF(X2="COP", "Columbian Peso", IF(X2="GHS", "Ghanian Cedi",""))))))

8. ## Re: Nested IF Function based on text condition

Hello again,

There is a newer Excel function called Switch that will do what you want also. See it at:

https://www.techonthenet.com/excel/f.../switch_ws.php

9. ## Re: Nested IF Function based on text condition

MarvinP … You are awesome. Just tried it, worked with no problems.

Thank you all for your assistance and solutions offered!!

10. ## Re: Nested IF Function based on text condition

you're welcome, AND thank you for the rep!
BTW MarvinP, interesting info on switch, unfortunately it won't work for my version of excel.

There are currently 1 users browsing this thread. (0 members and 1 guests)