Same Value from different number of values using MID & IF Functions

Ajmal Khursand

New Member
Joined
Nov 28, 2021
Messages
2
Office Version
  1. 2016
Platform
  1. Windows
Hi MrExcel team,
I want to get USD value or AFN value from following different types of accounts Using IF, AND & OR functions however, it didn't work properly for some accounts result was OK but for all not hence kindly assist me which formula to use?
Note: in accounts starting with 1 if value number 7 is 1 its AFN account and if value number 7 is 2 its USD account, however, accounts starting with I & C if Value number 6 is 1 its AFN and if Value number 6 is 2 its USD.
ACC​
Currency​
10029111xxxxx​
AFN​
10029121xxxxx​
USD​
10029911xxxxx​
AFN​
10029921xxxxx​
AFN​
1002512xxxxxx​
USD​
1003511xxxxxx​
AFN​
I02911xxxxxxx​
AFN​
I02912xxxxxxx​
USD​
I02921xxxxxxx​
AFN​
I02991xxxxxxx​
AFN​
I14992xxxxxxx​
USD​
C02511xxxxxxx​
AFN​
C02512xxxxxxx​
USD​
C02591xxxxxxx​
AFN​
C09592xxxxxxx​
USD​
C02601xxxxxxx​
AFN​
C14611xxxxxxx​
AFN​
C02612xxxxxxx​
USD​
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Hi & welcome to MrExcel.
How about
+Fluff 1.xlsm
AB
1ACCCurrency
210029111xxxxxAFN
310029121xxxxxUSD
410029911xxxxxAFN
510029921xxxxxUSD
61002512xxxxxxUSD
71003511xxxxxxAFN
8I02911xxxxxxxAFN
9I02912xxxxxxxUSD
10I02921xxxxxxxAFN
11I02991xxxxxxxAFN
12I14992xxxxxxxUSD
13C02511xxxxxxxAFN
14C02512xxxxxxxUSD
15C02591xxxxxxxAFN
16C09592xxxxxxxUSD
17C02601xxxxxxxAFN
18C14611xxxxxxxAFN
19C02612xxxxxxxUSD
Main
Cell Formulas
RangeFormula
B2:B19B2=IF(LEFT(A2)="1",IF(MID(A2,7,1)="1","AFN","USD"),IF(OR(LEFT(A2)={"I","C"}),IF(MID(A2,6,1)="1","AFN","USD")))
 
Upvote 0
=IF(LEFT(A2)="1",IF(MID(A2,7,1)="1","AFN","USD"),IF(OR(LEFT(A2)={"I","C"}),IF(MID(A2,6,1)="1","AFN","USD")))
Hi & welcome to MrExcel.
How about
+Fluff 1.xlsm
AB
1ACCCurrency
210029111xxxxxAFN
310029121xxxxxUSD
410029911xxxxxAFN
510029921xxxxxUSD
61002512xxxxxxUSD
71003511xxxxxxAFN
8I02911xxxxxxxAFN
9I02912xxxxxxxUSD
10I02921xxxxxxxAFN
11I02991xxxxxxxAFN
12I14992xxxxxxxUSD
13C02511xxxxxxxAFN
14C02512xxxxxxxUSD
15C02591xxxxxxxAFN
16C09592xxxxxxxUSD
17C02601xxxxxxxAFN
18C14611xxxxxxxAFN
19C02612xxxxxxxUSD
Main
Cell Formulas
RangeFormula
B2:B19B2=IF(LEFT(A2)="1",IF(MID(A2,7,1)="1","AFN","USD"),IF(OR(LEFT(A2)={"I","C"}),IF(MID(A2,6,1)="1","AFN","USD")))
Hi & welcome to MrExcel.
How about
+Fluff 1.xlsm
AB
1ACCCurrency
210029111xxxxxAFN
310029121xxxxxUSD
410029911xxxxxAFN
510029921xxxxxUSD
61002512xxxxxxUSD
71003511xxxxxxAFN
8I02911xxxxxxxAFN
9I02912xxxxxxxUSD
10I02921xxxxxxxAFN
11I02991xxxxxxxAFN
12I14992xxxxxxxUSD
13C02511xxxxxxxAFN
14C02512xxxxxxxUSD
15C02591xxxxxxxAFN
16C09592xxxxxxxUSD
17C02601xxxxxxxAFN
18C14611xxxxxxxAFN
19C02612xxxxxxxUSD
Main
Cell Formulas
RangeFormula
B2:B19B2=IF(LEFT(A2)="1",IF(MID(A2,7,1)="1","AFN","USD"),IF(OR(LEFT(A2)={"I","C"}),IF(MID(A2,6,1)="1","AFN","USD")))
Thank you so much it was really helpful and worked properly.
 
Upvote 0
Glad to help & thanks for the feedback.
 
Upvote 0
If all of your values are one or the other of those currencies, as in your samples, then this should suffice

21 11 29.xlsm
AB
1ACCCurrency
210029111xxxxxAFN
310029121xxxxxUSD
410029911xxxxxAFN
510029921xxxxxUSD
61002512xxxxxxUSD
71003511xxxxxxAFN
8I02911xxxxxxxAFN
9I02912xxxxxxxUSD
10I02921xxxxxxxAFN
11I02991xxxxxxxAFN
12I14992xxxxxxxUSD
13C02511xxxxxxxAFN
14C02512xxxxxxxUSD
15C02591xxxxxxxAFN
16C09592xxxxxxxUSD
17C02601xxxxxxxAFN
18C14611xxxxxxxAFN
19C02612xxxxxxxUSD
Sheet2
Cell Formulas
RangeFormula
B2:B19B2=IF(MID(A2,6+(LEFT(A2,1)="1"),1)="1","AFN","USD")
 
Upvote 0

Forum statistics

Threads
1,214,832
Messages
6,121,854
Members
449,051
Latest member
excelquestion515

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