Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 8 of 8

Thread: Leaving a cell unchanged in a formula

  1. #1
    New Member
    Join Date
    Feb 2002
    Location
    England
    Posts
    40
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hi,
    I need to input an IF formula in cell C1 that says if A1 = "Total", then print D1 (which is formula) otherwise leave the contents of C1 as they are.
    Is this at all possible??
    Thanks so much Mel xx

  2. #2
    Board Regular
    Join Date
    Feb 2002
    Location
    Where the wild roses grow
    Posts
    285
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Do you mean that if it doesn't meet the requirement, then you want to leave C1 blank? If so it'd be:

    =if(a1="total",d1,"")

    Is this what you mean?

  3. #3
    New Member
    Join Date
    Feb 2002
    Location
    England
    Posts
    40
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hi,
    No what i mean is that column C1 has a list of numbers in it and I want to write some VB that overights that information ONLY IF A1 says "Total". Therefore when I mean leave it blank I meant to say don't change the information that already exists in that cell.
    Cheers for the quick response.
    Mel x

  4. #4
    Board Regular
    Join Date
    Feb 2002
    Location
    Where the wild roses grow
    Posts
    285
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    So do you mean that you want a macro that would go down through the sheet and perform this function whenever you pressed a button?

  5. #5
    New Member
    Join Date
    Feb 2002
    Location
    England
    Posts
    40
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Audijoe,
    I guess that would be best. In that case i want to be able to highlight three cells (there are three totals in the spreadsheet)eg A1, A10, A20, and return the formula in those cells, overrighting any value that is there but leaving the formatting alone (the format for each cell will be different ie one total background is green, one is blue and one is orange.) This would save the lookup function being used.
    Cheers Mel

  6. #6
    Board Regular
    Join Date
    Feb 2002
    Location
    Where the wild roses grow
    Posts
    285
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Try this on your sheet. Paste it into a module and run it



    Sub GoGeddemBoys()

    lastRow = Cells.SpecialCells(xlCellTypeLastCell).Row

    For n = 1 To lastRow
    If Cells(n, 1).Value = "total" Then Cells(n, 3).Value = Cells(n, 4).Value
    Next

    End Sub

  7. #7
    New Member
    Join Date
    Feb 2002
    Location
    England
    Posts
    40
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Audiojoe,
    I don't know how to thank you!
    With a little bit of manipulation i now have a fully functional spreadsheet that does everything i want it to do!!
    Thank you so much for your help.
    Regards Mel xxxx

  8. #8
    Board Regular
    Join Date
    Feb 2002
    Location
    Where the wild roses grow
    Posts
    285
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default


    Not a problem


Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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