Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
mhoffmeier
 
Posts: n/a
Default sumproduct based on format

Is it possible to test a column of values based on their format? I'd
like to be able to use sumproduct on the italized numbers in a column.

  #2   Report Post  
Bob Phillips
 
Posts: n/a
Default sumproduct based on format

You would need a UDF that calculates if italicized, and use that like this

=SUMPRODUCT(--(IsItalics(A1:A10)))

Here is the UDF

'---------------------------------------------------------------------
Function IsItalics(rng As Range) As Variant
'---------------------------------------------------------------------
Dim cell As Range, row As Range
Dim i As Long, j As Long
Dim iWhite As Long, iBlack As Long
Dim ary As Variant

If rng.Areas.Count 1 Then
IsItalics = CVErr(xlErrValue)
Exit Function
End If

If rng.Cells.Count = 1 Then
ary = rng.Font.Italic
Else
ary = rng.Value
i = 0
For Each row In rng.Rows
i = i + 1
j = 0
For Each cell In row.Cells
j = j + 1
ary(i, j) = cell.Font.Italic
Next cell
Next row
End If

IsItalics = ary

End Function


--

HTH

RP
(remove nothere from the email address if mailing direct)


"mhoffmeier" wrote in message
ups.com...
Is it possible to test a column of values based on their format? I'd
like to be able to use sumproduct on the italized numbers in a column.



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
mhoffmeier
 
Posts: n/a
Default sumproduct based on format

Thanks, I need to learn how to program these functions. It is amazing

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Why does my format keep changing in the cell? Denise Excel Discussion (Misc queries) 0 August 30th 05 04:23 PM
How do I change the format of a cell based on what I input? Husker87 Excel Worksheet Functions 8 August 19th 05 10:45 PM
format cell based on results of vlookup function Edith F Excel Worksheet Functions 1 July 21st 05 07:39 PM
protecting format Esmerelda Excel Discussion (Misc queries) 1 February 25th 05 12:53 PM
formula based on format James Kendall Excel Discussion (Misc queries) 4 December 16th 04 04:47 PM


All times are GMT +1. The time now is 10:46 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"