Solved

Excel / Powershell  If statement with 3 variables

Posted on 2014-09-11
2
201 Views
Last Modified: 2014-09-11
Dear experts,

could anybody help me with this formula below?

If GAL =  -CustomAttribute4 'T' -CustomAttribute8 'LS' -CustomAttribute10 'LS' -CustomAttribute14 'HAD'
and SMTP =  '"&I2&"','"&J2&"','"&K2&"','SMTP:"&F2&"','smtp:"&G2&"','smtp:"&H2&

if GUL = -CustomAttribute4 'T' -CustomAttribute10 'LTS' -CustomAttribute14 'HAD'
and SMTP =  '"&I2&"','"&J2&"','"&K2&"','SMTP:"&F2&"','smtp:"&G2&"

all other not GUL or GAL = -CustomAttribute4 '"&P2&"  -CustomAttribute10 'LT' -CustomAttribute14 'HAD'
and SMTP =  '"&I2&"','"&J2&"','"&K2&"','SMTP:"&F2&"','smtp:"&G2&"  (same as "GUL")

I tried this behind but failed ;)  Thanks in advance!


="Start-Sleep -s 10;Set-Mailbox "&IF(ISERROR(SEARCH("GAL",L2)),IF(ISERROR(SEARCH("GUL",L2)),&" -CustomAttribute4 'T' -CustomAttribute8 'LS' -CustomAttribute10 'LS' -CustomAttribute14 'HAD' -EmailAddressPolicyEnabled $false -SingleItemRecoveryEnabled $true -EmailAddresses '"&I2&"','"&J2&"','"&K2&"','SMTP:"&F2&"','smtp:"&G2&"','smtp:"&H2&"' -Identity "&A2&"",A2&" -CustomAttribute4 'T' -CustomAttribute10 'LTS' -CustomAttribute14 'HAD' -EmailAddressPolicyEnabled $false -SingleItemRecoveryEnabled $true -EmailAddresses '"&I2&"','"&J2&"','"&K2&"','SMTP:"&F2&"','smtp:"&G2&"'-Identity "&A2&"))"

="Start-Sleep -s 10;Set-Mailbox "&IF(ISERROR(SEARCH("GAL",L2)),IF(ISERROR(SEARCH("GUL",L2)),&" -CustomAttribute4 'T' -CustomAttribute8 'LS' -CustomAttribute10 'LS' -CustomAttribute14 'HAD' -EmailAddressPolicyEnabled $false -SingleItemRecoveryEnabled $true -EmailAddresses '"&I2&"','"&J2&"','"&K2&"','SMTP:"&F2&"','smtp:"&G2&"','smtp:"&H2&"' -Identity "&A2&"",A2&" -CustomAttribute4 'T' -CustomAttribute10 'LTS' -CustomAttribute14 'HAD' -EmailAddressPolicyEnabled $false -SingleItemRecoveryEnabled $true -EmailAddresses '"&I2&"','"&J2&"','"&K2&"','SMTP:"&F2&"','smtp:"&G2&"'-Identity "&A2&"))"

Open in new window

0
Comment
Question by:Mandy_
2 Comments
 
LVL 50

Accepted Solution

by:
Rgonzo1971 earned 500 total points
ID: 40316712
pls try

="Start-Sleep -s 10;Set-Mailbox  -CustomAttribute4 '"&IF(ISERROR(SEARCH("GAL",L2)),IF(ISERROR(SEARCH("GUL",L2)),P2&"' -CustomAttribute10 'LT' -CustomAttribute14 'HAD' -EmailAddressPolicyEnabled $false -SingleItemRecoveryEnabled $true -EmailAddresses '"&I2&"';'"&J2&"';'"&K2&"';'SMTP:"&F2&"';'smtp:"&G2,"T' -CustomAttribute10 'LTS' -CustomAttribute14 'HAD' -EmailAddressPolicyEnabled $false -SingleItemRecoveryEnabled $true -EmailAddresses '"&I2&"';'"&J2&"';'"&K2&"';'SMTP:"&F2&"';'smtp:"&G2),"T' -CustomAttribute8 'LS' -CustomAttribute10 'LS' -CustomAttribute14 'HAD' -EmailAddressPolicyEnabled $false -SingleItemRecoveryEnabled $true -EmailAddresses '"&I2&"';'"&J2&"';'"&K2&"';'SMTP:"&F2&"';'smtp:"&G2&"';'smtp:"&G2)&"' -Identity "&A2
0
 
LVL 2

Author Closing Comment

by:Mandy_
ID: 40316886
perfect as usual. Great work!
0

Featured Post

Free eBook: Backup on AWS

Everything you need to know about backup and disaster recovery with AWS, for FREE!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.

679 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question