+ Reply to Thread
Results 1 to 6 of 6

Multisheet IF Function

  1. #1
    Larry
    Guest

    Multisheet IF Function

    I am trying to accomplish the following: If the value on Sheet 1 Cell K3 is
    blank, then the value on Sheet 2 Cell K3 is automatically left blank.
    Otherwise, any value entered on Sheet 1 Cell K3 will automatically be copied
    to Sheet 2 Cell K3. It is possible that the value entered in Sheet 1 Cell K3
    is preceeded by one or more zeros, so I have formatted Sheet 2 Cell K3 as
    'text'. I have tried the formula =IF(Sheet1!K3=0,"",(Sheet1!K3)) in Sheet2
    Cell K3, which doesn't work. Thanks for your help!

    Regards,
    Larry

  2. #2
    JE McGimpsey
    Guest

    Re: Multisheet IF Function

    Formulas return Values, not formats. To copy the format, you'll need
    VBA. One way:

    put this in your Sheet 1 code module (right-click the Sheet 1 tab and
    choose View Code):


    Private Sub Worksheet_Change(ByVal Target As Excel.Range)
    If Target.Address(False, False) = "K3" Then
    With Sheets("Sheet2").Range("K3")
    .NumberFormat = "@"
    .Value = Target.Text
    End With
    End If
    End Sub




    In article <02139BE0-F5FF-44D2-B2F8-98CECB8C0CDF@microsoft.com>,
    "Larry" <Larry@discussions.microsoft.com> wrote:

    > I am trying to accomplish the following: If the value on Sheet 1 Cell K3 is
    > blank, then the value on Sheet 2 Cell K3 is automatically left blank.
    > Otherwise, any value entered on Sheet 1 Cell K3 will automatically be copied
    > to Sheet 2 Cell K3. It is possible that the value entered in Sheet 1 Cell K3
    > is preceeded by one or more zeros, so I have formatted Sheet 2 Cell K3 as
    > 'text'. I have tried the formula =IF(Sheet1!K3=0,"",(Sheet1!K3)) in Sheet2
    > Cell K3, which doesn't work. Thanks for your help!


  3. #3
    Registered User
    Join Date
    09-16-2004
    Location
    Virginia
    Posts
    46
    Any leading zeros will be automatically dropped in Sheet1, ergo they won't appear in sheet two. If you wan't your leading zeros to appear, Sheet1 will have to be formatted to text. Then, the following formula will work:

    Please Login or Register  to view this content.
    Tom Stock
    Office version: MSO 2002 SP3
    OS: Windows XP Pro
    Hardware: IBM Thinkpad T41

  4. #4
    Larry
    Guest

    Re: Multisheet IF Function

    Thanks. That formula didn't accomplish what I hoped. I'm not concerned
    about the formatting, just the IF formula to copy anything placed in Sheet 1
    Cell K3 to Sheet 2 Cell K3. If Sheet 1 Cell K3 is blank, the Sheet 2 Cell K3
    should be blank. Otherwise, any valu placed in Sheet 1 Cell K3 should be
    copied to Sheet 2 Cell K3. I can work around the zero value defaults.

    "JE McGimpsey" wrote:

    > Formulas return Values, not formats. To copy the format, you'll need
    > VBA. One way:
    >
    > put this in your Sheet 1 code module (right-click the Sheet 1 tab and
    > choose View Code):
    >
    >
    > Private Sub Worksheet_Change(ByVal Target As Excel.Range)
    > If Target.Address(False, False) = "K3" Then
    > With Sheets("Sheet2").Range("K3")
    > .NumberFormat = "@"
    > .Value = Target.Text
    > End With
    > End If
    > End Sub
    >
    >
    >
    >
    > In article <02139BE0-F5FF-44D2-B2F8-98CECB8C0CDF@microsoft.com>,
    > "Larry" <Larry@discussions.microsoft.com> wrote:
    >
    > > I am trying to accomplish the following: If the value on Sheet 1 Cell K3 is
    > > blank, then the value on Sheet 2 Cell K3 is automatically left blank.
    > > Otherwise, any value entered on Sheet 1 Cell K3 will automatically be copied
    > > to Sheet 2 Cell K3. It is possible that the value entered in Sheet 1 Cell K3
    > > is preceeded by one or more zeros, so I have formatted Sheet 2 Cell K3 as
    > > 'text'. I have tried the formula =IF(Sheet1!K3=0,"",(Sheet1!K3)) in Sheet2
    > > Cell K3, which doesn't work. Thanks for your help!

    >


  5. #5
    JE McGimpsey
    Guest

    Re: Multisheet IF Function

    If you're not concerned with formatting, just put this in Sheet2!K3:

    =IF(Sheet1!K3="","",Sheet1!K3)

    In article <9998D99D-B508-4BBB-97EE-6E20F9DEAA80@microsoft.com>,
    "Larry" <Larry@discussions.microsoft.com> wrote:

    > Thanks. That formula didn't accomplish what I hoped. I'm not concerned
    > about the formatting, just the IF formula to copy anything placed in Sheet 1
    > Cell K3 to Sheet 2 Cell K3. If Sheet 1 Cell K3 is blank, the Sheet 2 Cell K3
    > should be blank. Otherwise, any valu placed in Sheet 1 Cell K3 should be
    > copied to Sheet 2 Cell K3. I can work around the zero value defaults.


  6. #6
    Registered User
    Join Date
    09-16-2004
    Location
    Virginia
    Posts
    46
    Quote Originally Posted by Larry
    Thanks. That formula didn't accomplish what I hoped.
    Who are you replying to? Are you using the formula in Sheet2? Your original formula should work fine except you need to check for empty string "" instead of 0.

    Quote Originally Posted by Larry
    I can work around the zero value defaults
    What zero-value defaults? Does your Sheet1!K3 cell always have a value in it? Does it have a formula?

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1