among three cells, if one is formatted (bolded), yield a value to a fourth cell

keyshawn_irvin

New Member
Joined
Sep 16, 2014
Messages
2
I have a spreadsheet in which I have three cells, one of which is bolded, and I need the fourth column to yield a specific value based on which of the three cells is bolded.

More specifically, if the first of the three cells is bolded, I'd like the fourth cell to yield a value of '1'. If the second is bolded, the fourth would yield '2'. The third, yield '3'.

Thanks for any help the forum can offer.
 

Rick Rothstein

MrExcel MVP
Joined
Apr 18, 2011
Messages
35,501
Office Version
2010
Platform
Windows
If you really only have three cells to check and if only one cell will be bold at any one time, then this should also work...
Code:
Function IsBold(Target As Range) As Long
  IsBold = -1 * Target(1).Font.Bold - 2 * Target(2).Font.Bold - 3 * Target(3).Font.Bold
End Function
 

NeonRedSharpie

Well-known Member
Joined
Jul 14, 2014
Messages
1,678
If you really only have three cells to check and if only one cell will be bold at any one time, then this should also work...
Code:
Function IsBold(Target As Range) As Long
  IsBold = -1 * Target(1).Font.Bold - 2 * Target(2).Font.Bold - 3 * Target(3).Font.Bold
End Function

I just wrote the additional loop in case anyone ever wants to expand the formula beyond the current scope. Who knows who will stumble upon this thread. The isbold function from the original thread got expanded to 3 from 1, so it could go up from here!
 

Rick Rothstein

MrExcel MVP
Joined
Apr 18, 2011
Messages
35,501
Office Version
2010
Platform
Windows
I just wrote the additional loop in case anyone ever wants to expand the formula beyond the current scope. Who knows who will stumble upon this thread. The isbold function from the original thread got expanded to 3 from 1, so it could go up from here!
That is why I started off by saying "If you really only have three cells to check.." in order to limit its applicability to a small number of cells.
 

keyshawn_irvin

New Member
Joined
Sep 16, 2014
Messages
2
NRS and Rick,

Thanks for your help - your advice worked brilliantly! So that you have some context, your time and advice has aided our project in which we are developing new and improved test items for students identified with significant cognitive disabilities. You have made a portion of my work much more efficient within a tight timeline.

Again, thank you for your assistance today!
--Keyshawn
 

Forum statistics

Threads
1,081,575
Messages
5,359,725
Members
400,545
Latest member
Damntheman30

Some videos you may like

This Week's Hot Topics

  • VBA (Userform)
    Hi All, I just would like to know why my code isn't working. Here is my VBA code: [CODE=vba]Private Sub OKButton_Click() Dim i As Integer...
  • List box that changes fill color
    Hello, I have gone through so many pages trying to figure this out. I have a 2020 calendar that depending on the day needs to have a certain...
  • Remove duplicates and retain one. Cross-linked cases
    Hi all I ran out of google keywords to use and still couldn't find a reference how to achieve the results of a single count. It would be great if...
  • VBA Copy and Paste With Duplicates
    Hello All, I'm in need of some input. My VBA skills are sub-par at best. I've assembled this code from basic research and it works but is...
  • Macro
    is it possible for a macro to run if the active cell value is different to the value above it
  • IF DATE and TIME
    I currently use this to check if date has passed but i also need to set a time on it too. Is it possible? [CODE=vba]=IF(B:B>TODAY(),"Not...
Top